MKMapView error and SFViewController error
I am getting an error when I try to use mapview
"Using an undeclared MKMapView type"
and "Using an undeclared MKMapViewDelegate type."
I also get an error when I try to call SFSafariViewController.
For the first two, the code
class pinViewController: UIViewController, UITextFieldDelegate, MKMapViewDelegate {
@IBOutlet weak var locationTextField: UITextField!
@IBOutlet weak var addPinBtn: UIButton!
@IBOutlet weak var linkTextField: UITextField!
@IBOutlet weak var mapView: MKMapView!
Safari view controller code
@IBAction func signUp(_ sender: AnyObject) {
let url = NSURL(string:"https://www.udacity.com/account/auth#!/signup")
let safariVC = SFSafariViewController(url: url as! URL)
present(safariVC, animated: true, completion: nil)
source to share
You need import
MapKit
to access the Apple Map related class and SafariServices
to access the SFSafariViewController
. So just add two operators import
to yourpinViewController
import MapKit
import SafariServices
Remember one tag that tests if the class name starts with Capital last, so just change pinViewController
topinViewController
source to share