Last active
March 16, 2020 12:25
-
-
Save dnedrow/02c2dd102d36b758aee986b8dcd018ef to your computer and use it in GitHub Desktop.
Example of using a block to set a variable in Swift.
This file contains hidden or 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
| self.fitLabel.isHidden = { (message: String?) -> Bool in | |
| guard let thisMessage = message else { | |
| return true | |
| } | |
| self.fitLabel.text = thisMessage | |
| self.fitLabel.textAlignment = self.traitCollection.horizontalSizeClass == .regular ? .right : .left | |
| return false | |
| }(vm.fitInfo?.message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment