objcio / core-data

Sample code for the objc.io Core Data book
https://www.objc.io/books/core-data
MIT License
770 stars 197 forks source link

Xcode 9.2, Swift 4 Compile Errors #41

Open joshuabryson opened 6 years ago

joshuabryson commented 6 years ago

The CapureSession.swift file does not compile. the setup function should become:

`fileprivate func setup() {

if !IOS_SIMULATOR

        session.sessionPreset = AVCaptureSession.Preset.photo
        let discovery = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInWideAngleCamera], mediaType: AVMediaType.video, position: .back)
        if let camera = discovery.devices.first {
        let input = try! AVCaptureDeviceInput(device: camera)
        if session.canAddInput(input) {
            session.addInput(input)
        }
    }
    photoOutput = AVCapturePhotoOutput()
    if self.session.canAddOutput(photoOutput) {
        self.session.addOutput(photoOutput)
    }
    #endif

}`

This is after accepting Xcode's automatic fixes.

floriankugler commented 6 years ago

We'll update the code for the next round of fixes/updates of the book. Thanks for pointing this out.