Expected declaration error in swift

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)
    }


}

You’re missing curly braces {} around the application:didFinishLaunching function’s body.

Note that you’re using our old ranging/monitoring APIs from the “Estimote SDK”, that’s deprecated in favor of our new “Proximity SDK”, so I’d recommend using that instead:

https://developer.estimote.com/proximity/ios-tutorial/

You can also download ready-made examples (I’d recommend the “Proximity Content” and “Notification” to begin with) from Estimote Cloud:

https://cloud.estimote.com/#/apps/add