Category: Swift

Introducing the any keyword

Swift 5.6 introduced a few addition to the language, and in particular one will be quite important in the future and is the keyword any to mark existential types. At the time of writing, this keyword is optional, but in future Swift versions some code will need to be refactored to avoid warnings and, eventually,

Continue Reading →

Lazy loading in SwiftUI

SwiftUI introduced from the very beginning the components HStack and VStack to group views in an horizontal or vertical stack. Those components load all their children up front, so they’re not suitable for implementing a long list of items, as you’d rather have lazy loading.One alternative was using the List component, which implements lazy loading,

Continue Reading →

Navigation in SwiftUI

Back in July I wrote a post about Navigation in SwiftUI trying to explain the difference between NavigationLink and DynamicNavigationDestinationLink. The latter has been deprecated, so the article is now useless, you can still find it here http://www.gfrigerio.com/navigation-in-swiftui-deprecated/I updated the repository on GitHub to remove the deprecated code and provide a few examples of various

Continue Reading →

Property Wrappers

This year’s WWDC was packed with new stuff for Swift developers, and one of them is property wrappers, formerly known as property delegate. Actually we knew about property delegate before WWDC, as there was a proposal in Swift.org a few months ago (you can read it at this link) but we didn’t know about SwiftUI

Continue Reading →

Networking example with Combine

This is the second post about Combine, after my quick introduction you can find here http://www.gfrigerio.com/combine-first-example/I’m using the same GitHub project https://github.com/gualtierofrigerio/CombineTest but this time I’m focusing on networking, with a similar example to the one I used for my series of posts about Future&Promise, RxSwift and AlamoFire. I’ll build the same table view controller

Continue Reading →

Moya and Alamofire

As I was playing with my GitHub project about networking I thought it would be interesting to try some different ways to implement the RESTClient protocol. In this article I’m going to show how I used Alamofire and then Moya (which itself uses Alamofire) instead of my custom network layer based on URLSession. I’m going

Continue Reading →

Show a PDF

Showing PDFs is pretty common for an iOS app. It could be a privacy policy document, an invoice, a flyer the company distributes on paper and via its app, a magazine.There are three possible ways of displaying a PDF. The simplest is to use a Webview. Just like loading a local page, or a remote

Continue Reading →

Barcode scanner

After a few projects made for fun, and for learning, I decided to publish something useful as a CocoaPod: a barcode and QR code scanner. I worked on a similar feature for an app available in the App Store in Objective-C, and decided to rewrite it in Swift to make it available on GitHub. https://github.com/gualtierofrigerio/GFBarcodeScanner

Continue Reading →

Building a fitness app

In this article I’m describing the GitHub project FitnessExample you can find here: https://github.com/gualtierofrigerio/FitnessExampleThe main topic is communicating between iOS and watchOS, but I thought I could introduced some HealthKit stuff as well as fitness is a very popular category of watchOS apps. I’ll update the article as I add functionalities to the project, the

Continue Reading →

Adding maps to your app

I recently put a sample project on github for using Apple Maps on an iOS application as I wanted to play with Core Location and Maps since I only dealt with Google Maps via Javascript in my existing apps. Here is the link to the project: https://github.com/gualtierofrigerio/GFMapKitWrapper I’ll eventually make it available on CocoaPods so

Continue Reading →