When to use Optionals in Swift

by Arnold Burian

Check out When to use Optionals in Swift by JR. Here is an excerpt:

Being new to Optionals, sometimes I struggle for good examples on where and when to use them.

Here’s an example I link that show how one could use an Optional to model an AccountBalance.

struct AccountBalance {
    init(_ ledger: Money, overdraftLimit: Money? = nil) {
        self.ledger =...

The full article is available here.

You may also like

This website uses cookies to improve your experience. Accept Read More