I’m getting an ‘Expected declaration error’ in swift when calling
self.beaconManager.delegate = self in the AppDeligate.swift
Please assist.
Here is the code:
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, ESTBeaconManagerDelegate {
var window: UIWindow?
let beaconManager = ESTBeaconManager()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool
self.beaconManager.delegate = self <<-- This is where the error is and wants it declared in class above
self.beaconManager.RequestAlwaysAuthorization()
self.beaconManager.startMonitoring(for: CLBeaconRegion(
proximityUUID: UUID(uuidString: "B9407F30-F5F8-466E-AFF9-25556B57FE6D")!,
major: 47827, minor: 638, identifier: "monitored region"))
return true
UIApplication.shared.registerUserNotificationSettings(
UIUserNotificationSettings(types: .alert, categories: nil))
func beaconManager(_ manager: Any, didEnter region: CLBeaconRegion) {
let notification = UILocalNotification()
notification.alertBody =
"Come closer for an intimate encounter with furniture " +
"from Einstein’s home at 112 Mercer Street, " +
"including Einstein’s writing desk – " +
"complete with ink spill – situated with Einstein’s favorite chair."
UIApplication.shared.presentLocalNotificationNow(notification)
}
}