Last active
July 15, 2019 07:01
-
-
Save janeshsutharios/d8b211085eed5b5f0aa25fe210776b4e to your computer and use it in GitHub Desktop.
Data Binding through Clousers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Step 1: | |
//Create button clouser | |
var tapsOnButtonClouser:() -> () = {} | |
var isTempBool = false | |
//Step 2: Setup that function | |
func setUpClouser() { | |
tapsOnButtonClouser = { [weak self] in | |
guard let localSelf = self else {return} | |
localSelf.isTempBool = !localSelf.isTempBool | |
print("Temp Bool changed to--> ",localSelf.isTempBool) | |
} | |
} | |
setUpClouser() | |
//Step 3: Invoke that function | |
tapsOnButtonClouser() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment