revidwerd

Day 14 of #100DaysOfSwiftUI was a review of structs, classes, optionals, functions and enums!

Day 13 of #100DaysOfSwiftUI is one of three recap days. Looked over variables, loops, constants, switch statements…

Day 12 of #100DaysOfSwiftUI was about nil, nil, nil, nil, nil….

Book sale!

A muddy lunch walk today.

Day 11 of #100DaysOfSwiftUI was all about protocols, extensions and protocol-oriented programming (POP).

David Abrahams via his talk at WWDC:

So, yes, Swift is great for object-oriented programming, but from the way for loops and string literals work to the emphasis in the standard library on generics, at its heart, Swift is protocol-oriented.

Curious if anyone in the micro.blog community has done or is doing morning pages? I used to be religious about this and I feel like it helped, at some point I broke the habit…

via Julia Cameron

Morning Pages are three pages of longhand, stream of consciousness writing, done first thing in the morning. *There is no wrong way to do Morning Pages*– they are not high art. They are not even “writing.” They are about anything and everything that crosses your mind– and they are for your eyes only. Morning Pages provoke, clarify, comfort, cajole, prioritize and synchronize the day at hand. Do not over-think Morning Pages: just put three pages of anything on the page…and then do three more pages tomorrow.

Hōjicha is my new (mildly) caffeinated obsession:

From Wikipedia:

Hōjicha (焙じ茶, ほうじ茶) is a Japanese green tea. It is distinctive from other Japanese green teas because it is roasted in a porcelain pot over charcoal, whereas most Japanese teas are steamed. The tea is fired at a high temperature, altering the leaf color tints from green to reddish brown. The process was first performed in Kyoto, Japan, in the 1920s and its popularity persists today

Steep for 45 seconds at 85º - 90º C

Day 10 of #100DaysOfSwiftUI was all about classes, inheritance, overriding (also blocking this via final), mutability and the differences between structs and classes. Important note:

SwiftUI uses structs extensively for its UI design. Well, it uses classes extensively for its data: when you show data from some object on the screen, or when you pass data between your layouts, you’ll usually be using classes.

Day 9 of #100DaysOfSwiftUI was all about structs (creating custom data types) and utilizing initializers as well as static and “lazy” properties.

This past Tuesday was fettisdagsbulle or “Fat Tuesday” here in Sweden. By the time I realized the date, the queues for Semla were insane and the quantities scarce.

However, today is a new day and I’m making up for it! This is a cinnamon bun semla (I also got a few traditional 😅).

Day 8 of #100DaysOfSwiftUI was all about structs, methods, mutability and finished with demoing how array and string types are structs and have their own methods which can be called to sort, append, etc.

Day 7 of #100DaysOfSwiftUI was closures part 2, this link will come in handy.

Revisiting Day 6 of #100DaysOfSwiftUI to truly ensure I get the basics down…

Time will tell, but I think I have a solid EP coming together…

I spent most of the weekend in review (see the previous post with a link to the iOS app)

Day 6 of #100DaysOfSwiftUI was an ease into the idea of closures. Though my head was a bit achy at first, I faired pretty well on each sections quiz. In order to somewhat solidify, one always calls paramaters after the first { and you always call the closure that accepts a parameter without the parameter label.

let myAcceptingClosure = { (something: String) in 
    print("I'm a closure that accepts a parameter, such as \(something)...")
}

// We call this WITHOUT the label
myAcceptingClosure("This")

End of week #100DaysOfSwiftUI progress 🤘🏼

I’m on level 11 in Unwrap by @twostraws. Download it here: itunes.apple.com/app/id144…

Day 5 of #100DaysOfSwiftUI was all about functions and their various incantations. This included returning values (tuples are great for returning more than 1 valule!), accepting parameters, labeling parameters for better legibility (omitting labels in some cases), setting default parameters, “inout” parameters, “throwing functions,” and variadic functions (passing in 0 or more values).

Ternary operators shine in SwiftUI as it uses single expression functions quite a bit:

func greet(name: String) -> String {
        name == "Drew Diver" ? "My liege..." : "Hello, \(name)! Back of the line!"
}

Parameter labels make function calls read naturally:

func sayHello(to name: String) {
        print("Hello, \(name)!")
}

sayHello(to: "Drew Diver”)

Omitting parameter labels makes sense in cases like the following:

func read(_ book: String) {
        print("Now reading \(book)...")
}

read("Walden")

Also In Objective-C:

…the first parameter to a function was always left unnamed, and so when you use those frameworks in Swift you’ll see lots of functions that have underscores for their first parameter label to preserve interoperability with Objective-C.

Day 4 of #100DaysOfSwiftUI was all about looping and included while, for, repeat. We then went within loops to apply continue (to skip) and/or break statements to exit. break can be combined with labeling the outermost loop to ensure we exit both loops like so:

outermost: for i in 1...10 {
    for j in 1...10 {
        let total = i * j
        print("\(i) * \(j) = \(total)")
        if total == 100 {
            print("That's enough!")
            break outermost
        }
    }
}

Day 3 of #100DaysOfSwiftUI included operators, compounds (+= or -= for instance), comparisons, switch statements, ternary and ranges!

I kind of like the look of ternary vs if blocks but I guess time and experience in Swift will tell…

var firstCard = 11
var secondCard = 10
print(firstCard + secondCard == 21 ? “Blackjack!” : “Regular cards”)

Currently reading: Walden by Henry David Thoreau 📚

Shams and delusions are esteemed for soundest truths, while reality is fabulous. If men would steadily observe realities only, and not allow themselves to be deluded, life, to compare it with such things as we know, would be like a fairy tale and the Arabian Nights’ Entertainments. If we respected only what is inevitable and has a right to be, music and poetry would resound along the streets. When we are unhurried and wise, we perceive the only great and worthy things have any permanent and absolute existence—that petty fears and petty pleasures are but the shadow of the reality.

Day 2 of #100DaysOfSwiftUI was about complex data types such as Arrays, Dictionaries, Tuples, Sets and Enums (including the use of Raw Values and Associated Values).

Doubling down on my efforts to get a grasp of Swift and SwiftUI this year… I just completed day 1 of #100DaysOfSwiftUI. This lesson introduced variables, integers, doubles, strings (interpolation / multi-line), boolean, constants and type declarations.

Obsessed with TaskPaper! This is exactly what I’ve been looking for to manage my plain text todo’s.

Currently reading: Walden by Henry David Thoreau 📚

If I were to be stranded on a desert island and could carry only one book, it would be Walden without a doubt.