iOS Swift Cannot Get Current User

I have tried many times and emailed customer support as well as reading and re-reading the API

The api states to use this line of code to get the current user

var currentUser: BackendlessUser { get }

However this code does not work. There is an error in the closing of the last bracket }
What is this { get } part of the code supposed to do?
The API says this should return nil if there is no current user logged in, however I CANNOT get this functionality to work for the life of me.

I am trying to use this on my view did load to supply the user with a view if they are not logged in or else hide that view from them.

Any help would be greatly appreciated, thanks.

Hi Joey!

Here is an example:

    func userLoginSync() {
        
        Types.tryblock({ () -> Void in
            
            self.backendless.userService.setStayLoggedIn(true)
            let user = self.backendless.userService.login("bob@foo.com", password:"1")
            NSLog("LOGINED USER: %@", user.description)
            
            var currentUser: BackendlessUser?
            currentUser = self.backendless.userService.currentUser
            print("CURRENT USER:", currentUser)
            
            },
            
            catchblock: { (exception) -> Void in
                NSLog("FAULT: %@", exception as! Fault)
            },
            
            finally: { () -> Void in
                NSLog("USER OPERATIONS ARE FINISHED")
            }
        )
    }

Regards,
Kate.

Thank you, this worked. For anyone using this at a later date for reference specifically:

var currentUser: BackendlessUser?
currentUser = self.backendless.userService.currentUser
print("CURRENT USER:", currentUser)

Really wish the API was a little more clear as this is an essential feature in many apps.