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
@resultBuilder | |
enum AttributedStringBuilder { | |
static func buildBlock(_ components: NSAttributedString...) -> NSAttributedString { | |
let attributedString = NSMutableAttributedString() | |
for component in components { | |
attributedString.append(component) | |
} | |
return attributedString | |
} | |
} |
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
// Write your code below 🏦 | |
struct SwiftBank { | |
private let password: String | |
private var balance: Double = 0 { | |
didSet { | |
if balance < 100 { | |
displayLowBalanceMessage() | |
} | |
} | |
} |