Retired Document
Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
CloudPhotos (OS X).swift/CloudPhotos/MediaObjectToModDateTransformer.swift
/* |
Copyright (C) 2017 Apple Inc. All Rights Reserved. |
See LICENSE.txt for this sample’s licensing information |
Abstract: |
NSValueTransformer subclass for transforming MLMediaObject to it's modification date value. |
*/ |
import Foundation |
import MediaLibrary |
class MediaObjectToModDateTransformer : ValueTransformer { |
func transformedValueClass() -> AnyClass { |
return CLLocation.self |
} |
func allowsReverseTransformation() -> Bool { |
return false |
} |
override func transformedValue(_ value: Any?) -> Any? { |
guard value != nil else { return nil } |
let mediaObject = value as! MLMediaObject |
let returnDate = mediaObject.attributes["modificationDate"] |
return returnDate |
} |
} |
Copyright © 2017 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2017-03-09