Проблемы с созданием анимированного GIF в Swift

Я пытаюсь создать анимированный GIF из массива 4UIImage элементы в Swift, но в настоящее время он сохраняет только первый кадр.

let url = NSURL(fileURLWithPath: photosDirectory)?.URLByAppendingPathComponent(filename())

if let url = url {
    let fileProperties = [kCGImagePropertyGIFDictionary as String: [kCGImagePropertyGIFLoopCount as String: 0]]
    let gifProperties = [kCGImagePropertyGIFDictionary as String: [kCGImagePropertyGIFDelayTime as String: 0.125]]
    let destination = CGImageDestinationCreateWithURL(url, kUTTypeGIF, photos.count, nil)

    CGImageDestinationSetProperties(destination, fileProperties)

    for photo in photos {
        CGImageDestinationAddImage(destination, photo.CGImage, gifProperties)
    }

    return CGImageDestinationFinalize(destination)
}
else {
    return false
}

photos это массивUIImages filename() просто возвращает строку как20150805.gif

Возвращает true, но только первый кадр в GIF

Ответы на вопрос(1)

Ваш ответ на вопрос