I am using some code off of github and trying to convert it to Swift 3.0. I have done everything up until now, but I am getting this one error on 3 lines in the code:
Type of expression is ambiguous without more context
Below I have marked the lines that are labeled by this error. How do I go about fixing this? Everything else works that I know of. I just can't test the demo itself until this is fixed.
//
// PasscodeSettingsViewController.swift
// PasscodeLockDemo
//
// Created by Yanko Dimitrov on 8/29/15.
// Copyright © 2015 Yanko Dimitrov. All rights reserved.
//
import UIKit
import PasscodeLock
class PasscodeSettingsViewController: UIViewController {
@IBOutlet weak var passcodeSwitch: UISwitch!
@IBOutlet weak var changePasscodeButton: UIButton!
@IBOutlet weak var testTextField: UITextField!
@IBOutlet weak var testActivityButton: UIButton!
fileprivate let configuration: PasscodeLockConfigurationType
init(configuration: PasscodeLockConfigurationType) {
self.configuration = configuration
super.init(nibName: nil, bundle: nil)
}
@IBAction func passcodeSwitchValueChange(_ sender: UISwitch) {
let passcodeVC: PasscodeLockViewController
if passcodeSwitch.isOn {
// Error on next line
passcodeVC = PasscodeLockViewController(state: .SetPasscode, configuration: configuration)
} else {
// Error on next line
passcodeVC = PasscodeLockViewController(state: .RemovePasscode, configuration: configuration)
passcodeVC.successCallback = { lock in
lock.repository.deletePasscode()
}
}
present(passcodeVC, animated: true, completion: nil)
}
@IBAction func changePasscodeButtonTap(_ sender: UIButton) {
let repo = UserDefaultsPasscodeRepository()
let config = PasscodeLockConfiguration(repository: repo)
let passcodeLock = PasscodeLockViewController(state: .ChangePasscode, configuration: config)
// Error on next line
presentViewController(passcodeLock, animated: true, completion: nil)
}
}
PasscodeLockViewController's definition or give the link to GitHub repo.