100 Days of SwiftUI – Day 29 – Hacking with Swift

A lot of people have mixed feelings about Monday’s. For me, I look at them with gratitude that I’m still employed. After this last weekend, I’m just happy that I don’t have to think about that disaster called a super bowl and can get back to “Hacking with Swift”!

Imagine my surprise to see this as the first line of today’s activity!

It’s time for another new project, and this is actually the last easy project we have on this course – after this the difficulty level ramps up a little as we tackle bigger apps, so enjoy this while it lasts!

The last couple of projects have really started to dive into some of the frameworks and just hope that I’ve given myslef enough time to really let the lessons stick in my brain as I move forward.

This lesson was kind of fun in that it reminded me that Swift and SwiftUI still takes a lot of utilities from the UIKit. On the shoulders of giants, indeed.

100 Days of SwiftUI – Day 28 – Hacking with Swift

I’m pretty happy that this review day landed on a Sunday. It lets me go over my previous posts and to enjoy the Superb Owl.

That’s where I want you to reach with SwiftUI – to know that when you have a new project idea you can reach for part of project 1, part of project 3, part of project 4, and beyond, and already be 75% towards your goal. You’ll get there – just keep coming back each day!

100 Days of SwiftUI – Day 27 – Hacking with Swift

I’ve decided to change the default title for these posts to reflect what resource that I’m working on and make sure that all post related to my journey with Swift are in the “SwiftSlowly” Category.

Today’s activity is about CoreML and I can already tell that it’s going to be something that I’m going to have to review a little more.

Today we’re going to build our project, combining both SwiftUI and Core ML in remarkably few lines of code – I think you’ll be impressed.

The source material is amazing!

I’m looking at the things that haven’t kept up with when the original material was created as an opportunity to get do my own research. For example, changing the call to the CoreML model.

Some of the methods are deprecated.

Luckily, I found a post about using duckduckgo and found a solution.

For extra cool points, I’m excited that I can still follow along with the understanding of what changed as far as the method call. My understanding is that the method calls to CoreML have changed. I don’t have the why at this point.

I’m also hoping that I’ll learn a better way of handling errors other than printing to the console, but that can be added to my technical debt pile.

Swift Slowly: Day 40 - Hacking Swift 26

I’ve finished a quarter of the program! I’m pretty proud of myself for doing that. With everything going on it was good to have a nice project like this to work on.

That being said, I was very happy to see the following quote.

However, I want to say that if at any point you’re feeling tired, or if life just gets in the way, take a break! If you come back to your code in a day or two, you’ll be more relaxed and ready to learn. Like I said at the beginning, this is a marathon not a sprint, and you won’t learn effectively if you’re stressed.

I’m very tempted to take today off, but I’m also just as pumped to play around with the material before WandaVision comes on tonight.

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!

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)
    }
}

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.

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.

Micro.blog February Photo Challenge 📷

Micro.blog February Photo Challenge 📷

Day 2: morning beverage

Aeropress brewing coffee.

I bought an aeropress years ago and it’s really made a difference in how I enjoy coffee.

Micro.blog February Photo Challenge 📷

Micro.blog February Photo Challenge 📷

Day 1: Close up

My stomach.

This is a pic of what I see when I look straight down. So I decided that I’m going work hard to see my toes again.