Sup!

Swift Slowly: Day 39 - Hacking Swift 25

Today is a consolidation and challenge day! I’m a quarter of the way through this and I’m pretty excited and grateful to have made it this far. With that comes a little more stress as I’m venturing out on my own to do small challenges along the way.

Which brings me to the challenge!

Challenge

You have a basic understanding of arrays, state, views, images, text, and more, so let’s put them together: your challenge is to make a brain training game that challenges players to win or lose at rock, paper, scissors.

The first thing I did was take some time to sketch out what I want the application to look like.

Rough Sketch with my rubber duck partner.

It really didn’t take that long to get something on screen.

Barebones of an application ui.

I’m taking a lot of the lessons and code from the Guess the flag game that I created earlier in order to move forward with this. I was fun to put the application together and I even spent some time doing some customization.

Application at the end.

What took me the most time, was actually coming up with the logic to the game. Apparently, working on something complex after many days of not getting enough sleep can wear you down. Luckily, there is pen and paper and the ability to forgive myself and move on.

My note book explaining the logic to myself

I’m just happy to be done!

Made a short video of my dog in a dress.

This is how hard it’s to get her up in the morning. I’d let her sleep but she’ll poop on the floor later.

Micro.blog February Photo Challenge 📷

Day 3: Layers

My dog under a layer of blankets.

Lillie under the blankets.

Swift Slowly: Day 38 - Hacking with Swift 24

It’s the middle of the week and it’s a good time to do some Swift development!

I’m a little struck by one of the things that Paul wrote in today’s exercise.

Albert Einstein once said, “any fool can know; the point is to understand,” and this project was specifically about giving you a deeper understanding of what makes SwiftUI tick. After all, you’ll be spending the next 76 days working with it, so it’s a good idea to make sure your foundations are rock solid before moving on.

Today’s activity is to go back and cement what I’ve learned by accomplishing three challenges. I get most of the changes, but it seems like some of the code has changed over time.

Extension error.

I got the other part of the challenge working, but it seams like the logic for ViewModifier isn’t working with my current release of Xcode/Swift.


Update!


Another user let me know that .fontWeight is only on Text. I was really preoccupied that the challenge needed to work on views. I handled this by having multiple methods; one for Text and another for Content.

struct Title: ViewModifier {
    
    func body(text:Text) -> some View {
        text
            .font(.largeTitle)
            .fontWeight(.black)
            .foregroundColor(.white)
    }
    
    func body(content:Content) -> some View {
        content
            .font(.largeTitle)
            //.fontWeight(.black)
            .foregroundColor(.white)
    }
}

New “Coming 2 America" trailer!

I used to watch this with my mom on a regular basis.

Micro.blog February Photo Challenge 📷

Day 3: Comfort

This is my dog Lillie laying in what used to be my bed.

Micro.blog February Photo Challenge 📷 2

Micro.blog February Photo Challenge 📷

Day 3: Comfort

Dog sleeping
Dog sleeping

I wish I could go back to sleep for a couple more hours.

Apple Releases macOS 11.3 Beta with New Safari Features, Reminders Sorting, Music Updates, and Improvements to iOS and iPadOS Apps Running on M1 Macs - MacStories

The new beta looks really interesting. I’m plan on upgrading from Catalina this weekend.

Swift Slowly: Day 38 - Hacking Swift 23

Today’s activity is research.

I’m a little nervous about what is coming next because this was the first time that I saw the syntax for templates and custom containers.

I’m going to have to read it again before I go to bed and hope that it makes more sense in the morning.