Documentation Archive Developer
Search

QuickLook Changes for Swift

QuickLook

Declaration
From
class QLPreviewController : UIViewController {
    class func canPreviewItem(_ item: QLPreviewItem!) -> Bool
    unowned(unsafe) var dataSource: QLPreviewControllerDataSource!
    func reloadData()
    func refreshCurrentPreviewItem()
    var currentPreviewItemIndex: Int
    var currentPreviewItem: QLPreviewItem! { get }
    unowned(unsafe) var delegate: QLPreviewControllerDelegate!
}
To
class QLPreviewController : UIViewController {
    class func canPreviewItem(_ item: QLPreviewItem) -> Bool
    weak var dataSource: QLPreviewControllerDataSource?
    func reloadData()
    func refreshCurrentPreviewItem()
    var currentPreviewItemIndex: Int
    var currentPreviewItem: QLPreviewItem? { get }
    weak var delegate: QLPreviewControllerDelegate?
}

Declaration
From
class func canPreviewItem(_ item: QLPreviewItem!) -> Bool
To
class func canPreviewItem(_ item: QLPreviewItem) -> Bool

Declaration
From
var currentPreviewItem: QLPreviewItem! { get }
To
var currentPreviewItem: QLPreviewItem? { get }

Declaration
From
unowned(unsafe) var dataSource: QLPreviewControllerDataSource!
To
weak var dataSource: QLPreviewControllerDataSource?

Declaration
From
unowned(unsafe) var delegate: QLPreviewControllerDelegate!
To
weak var delegate: QLPreviewControllerDelegate?

Declaration
From
protocol QLPreviewControllerDataSource {
    func numberOfPreviewItemsInPreviewController(_ controller: QLPreviewController!) -> Int
    func previewController(_ controller: QLPreviewController!, previewItemAtIndex index: Int) -> QLPreviewItem!
}
To
protocol QLPreviewControllerDataSource {
    func numberOfPreviewItemsInPreviewController(_ controller: QLPreviewController) -> Int
    func previewController(_ controller: QLPreviewController, previewItemAtIndex index: Int) -> QLPreviewItem
}

DeclarationIntroduction
From
func numberOfPreviewItemsInPreviewController(_ controller: QLPreviewController!) -> Int
iOS 8.0
To
func numberOfPreviewItemsInPreviewController(_ controller: QLPreviewController) -> Int
iOS 4.0

DeclarationIntroduction
From
func previewController(_ controller: QLPreviewController!, previewItemAtIndex index: Int) -> QLPreviewItem!
iOS 8.0
To
func previewController(_ controller: QLPreviewController, previewItemAtIndex index: Int) -> QLPreviewItem
iOS 4.0

Declaration
From
protocol QLPreviewControllerDelegate : NSObjectProtocol {
    optional func previewControllerWillDismiss(_ controller: QLPreviewController!)
    optional func previewControllerDidDismiss(_ controller: QLPreviewController!)
    optional func previewController(_ controller: QLPreviewController!, shouldOpenURL url: NSURL!, forPreviewItem item: QLPreviewItem!) -> Bool
    optional func previewController(_ controller: QLPreviewController!, frameForPreviewItem item: QLPreviewItem!, inSourceView view: AutoreleasingUnsafeMutablePointer<UIView?>) -> CGRect
    optional func previewController(_ controller: QLPreviewController!, transitionImageForPreviewItem item: QLPreviewItem!, contentRect contentRect: UnsafeMutablePointer<CGRect>) -> UIImage!
}
To
protocol QLPreviewControllerDelegate : NSObjectProtocol {
    optional func previewControllerWillDismiss(_ controller: QLPreviewController)
    optional func previewControllerDidDismiss(_ controller: QLPreviewController)
    optional func previewController(_ controller: QLPreviewController, shouldOpenURL url: NSURL, forPreviewItem item: QLPreviewItem) -> Bool
    optional func previewController(_ controller: QLPreviewController, frameForPreviewItem item: QLPreviewItem, inSourceView view: AutoreleasingUnsafeMutablePointer<UIView?>) -> CGRect
    optional func previewController(_ controller: QLPreviewController, transitionImageForPreviewItem item: QLPreviewItem, contentRect contentRect: UnsafeMutablePointer<CGRect>) -> UIImage
}

DeclarationIntroduction
From
optional func previewController(_ controller: QLPreviewController!, frameForPreviewItem item: QLPreviewItem!, inSourceView view: AutoreleasingUnsafeMutablePointer<UIView?>) -> CGRect
iOS 8.0
To
optional func previewController(_ controller: QLPreviewController, frameForPreviewItem item: QLPreviewItem, inSourceView view: AutoreleasingUnsafeMutablePointer<UIView?>) -> CGRect
iOS 4.0

DeclarationIntroduction
From
optional func previewController(_ controller: QLPreviewController!, shouldOpenURL url: NSURL!, forPreviewItem item: QLPreviewItem!) -> Bool
iOS 8.0
To
optional func previewController(_ controller: QLPreviewController, shouldOpenURL url: NSURL, forPreviewItem item: QLPreviewItem) -> Bool
iOS 4.0

DeclarationIntroduction
From
optional func previewController(_ controller: QLPreviewController!, transitionImageForPreviewItem item: QLPreviewItem!, contentRect contentRect: UnsafeMutablePointer<CGRect>) -> UIImage!
iOS 8.0
To
optional func previewController(_ controller: QLPreviewController, transitionImageForPreviewItem item: QLPreviewItem, contentRect contentRect: UnsafeMutablePointer<CGRect>) -> UIImage
iOS 4.0

DeclarationIntroduction
From
optional func previewControllerDidDismiss(_ controller: QLPreviewController!)
iOS 8.0
To
optional func previewControllerDidDismiss(_ controller: QLPreviewController)
iOS 4.0

DeclarationIntroduction
From
optional func previewControllerWillDismiss(_ controller: QLPreviewController!)
iOS 8.0
To
optional func previewControllerWillDismiss(_ controller: QLPreviewController)
iOS 4.0

Modified QLPreviewItem
Declaration
From
protocol QLPreviewItem : NSObjectProtocol {
    var previewItemURL: NSURL! { get }
    optional var previewItemTitle: String! { get }
}
To
protocol QLPreviewItem : NSObjectProtocol {
    var previewItemURL: NSURL { get }
    optional var previewItemTitle: String? { get }
}

Declaration
From
optional var previewItemTitle: String! { get }
To
optional var previewItemTitle: String? { get }

Declaration
From
var previewItemURL: NSURL! { get }
To
var previewItemURL: NSURL { get }