#46 - Money, Shortcuts, and external displays

Money

This library is a companion for the latest Flight School book: Guide to Swift Numbers. It is by far the neatest currency management library I’ve ever seen.

It has a Money type with required associated Currency. There is a Currency for each ISO 4217 currency code.

You to do math with the currency safely:

let prices: [Money<USD>] = [2.19, 5.39, 20.99, 2.99, 1.99, 1.99, 0.99]
let subtotal = prices.reduce(0.00, +) // "$36.53"
let tax = 0.08 * subtotal // "$2.92"
let total = subtotal + tax // "$39.45"

The README goes into details of how to use this library to formatting monetary amounts, support multiple currencies, and adding custom currencies.

And in case you need to convert between currencies checkout CurrencyConverter also by Mattt from Flight School.

UserDefaultsStore

This library by Omar Albeik streamlines the process of storing Codable object to UserDefaults.

The only requirement is to make your objects to the Identifiable protocol, providing a way for them to be retrieved from the store.

struct Laptop: Codable, Identifiable {
    static let idKey = \Laptop.model
    ...
}

let laptopsStore = UserDefaultsStore<Laptop>(uniqueIdentifier: "laptops")!

let macbook = Laptop(model: "A1278", name: "MacBook Pro")

try laptopsStore.save(mackbook)

let laptop = laptopsStore.object(withId: "A1278")

Sharecuts

This is a live example of a website built using Vapor.

You might not be interested in server side Swift just yet, but I’m sure you’ll like the growing collection of iOS 12 shortcuts puts Guilherme Rambo.

Check it out at sharecuts.app.

Lunar.

Lunar by Alin Panaitiu is a macOS app providing “intelligent adaptive brightness” for external displays, and with nice animations too.

🖥 animation showcasing the Lunar interface


Thank you for making it this far. Can I ask you a favour? I have put together a 5 questions survey to learn more about the readers and how to best serve you. Mind filling it up?

👉 Go to super short survey 👈

Thanks 💙