Created
July 19, 2020 18:09
-
-
Save jamesrochabrun/13c433a0a270b9b01c69a98947958fcc to your computer and use it in GitHub Desktop.
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
import UIKit | |
class Vc: UIViewController { | |
var top: CGFloat? { 8 } | |
} | |
let viewController = Vc() | |
let a: CGFloat = 1.0 | |
let b: CGFloat = 2.0 | |
let result = (viewController as? Vc)?.top ?? a < b ? 10 : 15 | |
print(result) // 15 | |
print((viewController as? Vc)!.top ?? a < b) // flase |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment