Duffy DD
Duffy DD

Reputation: 51

Change code from Swift 2 to swift 4

I'm new in Swift and i want your help please.

I am writing a code from an tutorial swift 2 and i want to write in swift 4.

    let imgManager = PHImageManager.default()
    let requestOptions = PHImageManager()
    requestOptions.synchronous = true  //error:Value of type 'PHImageManager' has no member 'synchronous'
    requestOptions.deliveryMode = .highQualityFormat   // error:Value of type 'PHImageManager' has no member 'deliveryMode'

Upvotes: 1

Views: 148

Answers (1)

PPL
PPL

Reputation: 6565

It should be like this,

let imgManager = PHImageManager.default()
let requestOptions = PHImageRequestOptions()
requestOptions.isSynchronous = true
requestOptions.deliveryMode = .highQualityFormat

requestoptions is PHImageRequestOptions() not PHImageManager()

Please read more about PHImageManager apple class reference

Upvotes: 3

Related Questions