Posted on

Adventures in Swift

I have been inspired by Apple’s WWDC 2024, especially how capable SwiftUI has become and I think it is a great time to write an app.

I plan on documenting the journey building an app from the ground up, starting with design principles and sketch boards, developing a minimum viable product, implementing core features, publishing on the App Store and writing documentation along the way. 

I will show how I fix bugs that appear, so hopefully it can help others frustrated by the same issues.

I am just going to focus on iPhone apps at the moment, but hope to explore iPad apps too.

So, join me as I continue my Adventures in Swift and we start on our app building journey together.

Posted on

ByteCoin

I finished the ByteCoin project, which gets the latest Bitcoin price in various currencies. I had a bug where I forgot to set the coinManager.delegate = self but I tracked that one down pretty quickly. There weren’t any instructional coding videos with this one, just lots of referring back to the Clima app we made previously. We did get to play with the UIPickerView though.

Posted on

Bugs for Christmas

Today I start four days off for Christmas, so naturally I am back into Swift programming. I am working on the Clima app which finds the weather for a given city. I just started to implement CoreLocation but I came across a bug: didUpdateLocations was not getting called in my CLLocationManagerDelegate extension. I did some searching on Stack Overflow (which today I actually joined after being a lurker for years) and the solution was to call:

locationManager(_: CLLocationManager, didUpdateLocations locations: [CLLocation])

instead of:

locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])

which was the default code dropped in when I code completed didUpdateLocations.

I also had an issue when looking up locations that had a space in their name, such as New York or Los Angeles. The urlString wasn’t converting these spaces to ‘%20’, so I changed it to:

let urlString = "\(weatherURL)&q=\(cityName)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!

Okay, the turkey is done and I am ready for Christmas lunch!