Building Collection Views in SwiftUI with LazyVGrid and LazyHGrid
The initial release of SwiftUI didn’t come with a native collection view. You can either build your own solution or use third party libraries. In this year’s WWDC, Apple introduced tons of new features for the SwiftUI...
How to Access Photo Library and Use Camera in SwiftUI
Earlier, we explored the use of UIViewRepresentable and show you how to integrate UITextView into a SwiftUI project. While you can use the UIViewRepresentable protocol to wrap a UIKit view, but how about a view controller? You...
Creating a SwiftUI TextView Using UIViewRepresentable
I enjoy so much working with the SwiftUI framework. Like most new frameworks, however, one drawback is that it doesn’t come with all UI controls which are available in UIKit. For example, you can’t find a SwiftUI...
SwiftUI Tip: How to Remove Line Separators in List View
The List view in SwiftUI is very similar to the table view in UIKit. It is also designed for developers to present a list of items row by row. By default, each row of data is separated by a line separator. In UIKit, you can...
Building a Search Bar in SwiftUI
One recent question I got is about the implementation of search bar in SwiftUI projects. Unlike UIKit, SwiftUI doesn’t come with a built-in control for search bar. You may use the UIViewRepresentable protocol to reuse...
Learn SwiftUI Using Swift Playgrounds for iPad and Mac
“I only have an iPad. Can I use it to develop iOS apps?” This is one of the most common questions for beginners. My answer is always “No, you need a Mac to run Xcode for iOS app development.” “But...
Unable to Set Layout Constraint to Zero in Xcode 11.3
If you’ve upgraded to Xcode 11.3 and you use Interface Builder to create the app UI, you may find it impossible to set the value of spacing constraints to zero. Just open Interface Builder and click “Add new...
Working with JSON and Codable in Swift 5
First, what’s JSON? JSON (short for JavaScript Object Notation) is a text-based, lightweight, and easy way for storing and exchanging data. It’s commonly used for representing structural data and data interchange in...
Working with SwiftUI Gestures and @GestureState
If you’ve been programming with SwiftUI before, you probably got a taste of building gestures with SwiftUI. You use the onTapGesture modifier to handle a user’s touch and provide a corresponding response. In this...
How to Create Perspective Text Using SwiftUI
If you’ve worked with UIKit before, the Text control in SwiftUI is very similar to UILabel in UIKit. It’s a view for you to display one or multiple lines of text. This Text control is...