Skip to content

Instantly share code, notes, and snippets.

View rhenz's full-sized avatar
🎯
Focusing

Renz rhenz

🎯
Focusing
  • Singapore
View GitHub Profile
@rhenz
rhenz / NSMutableAttributedString+ResultBuilder.swift
Last active June 25, 2022 15:10
Attributed String using ResultBuilder and some methods by extending NSMutableAttributedString
@resultBuilder
enum AttributedStringBuilder {
static func buildBlock(_ components: NSAttributedString...) -> NSAttributedString {
let attributedString = NSMutableAttributedString()
for component in components {
attributedString.append(component)
}
return attributedString
}
}
@rhenz
rhenz / SwiftBank.swift
Last active March 16, 2022 15:56
SwiftBank Project Solution
// Write your code below 🏦
struct SwiftBank {
private let password: String
private var balance: Double = 0 {
didSet {
if balance < 100 {
displayLowBalanceMessage()
}
}
}