Learn Swift and iOS Development
Master iOS development through in-depth tutorials and comprehensive courses on Swift, SwiftUI, UIKit, Core Data, and more.
Master iOS development through in-depth tutorials and comprehensive courses on Swift, SwiftUI, UIKit, Core Data, and more.
Discover the newest tutorials on Swift and iOS development
Discover the newest tutorials on Swift and iOS development
Showing 673 to 684 of 716 posts
Detecting gestures used to be tricky in the early days, but that changed with the introduction of the UIGestureRecognizer class in iOS 3.2. In this post, I show you how to use a tap gesture recognizer in Swift using the UITapGestureRecognizer class. We create a simple application and add a tap gesture recognizer to detect single and double taps.
in UIKit
Optionals are arguably the most challenging and frustrating aspect for developers that are new to Swift. What is an optional? What are the best practices for working with optionals? I explain this in detail in another post. This post zooms in on a very common error message developers run into.
in Fundamentals
Before I can explain the difference between instance methods and type methods, you first need to understand what an instance is and what a type is. Let me show you an example. Fire up Xcode and create a playground. Remove the contents of the playground and declare a struct with name User. The struct declares one constant property, name of type String.
in Fundamentals
A memberwise initializer is an initializer that is automatically generated by the compiler for structs that don't define a custom initializer in their declaration. That sound complicated. Let me show you a few examples to explain this in more detail. Create an empty playground if you want to follow along.
in Fundamentals
The ampersand indicates that the subscriptions variable is passed to the store(in:) method as an in-out parameter. What are in-out parameters? That is the focus of this episode.
in Swift
The nil-coalescing operator is represented by two question marks in Swift. It is one of the operators I miss most when working in Objective-C. The nil-coalescing operator isn't unique to Swift, though. Many languages have a nil-coalescing operator. Some language use the term null-coalescing operator. Let me show you how the nil-coalescing operator works.
in Fundamentals
The Foundation framework makes it painless to convert a string to a date, but there are a few pitfalls you need to watch out for. The class we use to convert a string to a date in Swift is DateFormatter (or NSDateFormatter if you are using Objective-C). I encourage you to follow along with me. Fire up Xcode and create a playground.
in Fundamentals
The short answer to this question is simple. A method is a function that is associated with a type, that is, a class, a struct, or an enum. This means that every method is a function, but not every function is a method. The long answer is more interesting, though.
in Fundamentals
Swift isn't a functional programming language, but you can use functional techniques in the code you write. Why is that? Swift has a number of functional features. For example, Swift has first-class functions and that opens up some interesting possibilities. In this post, you learn about higher-order functions and how you can use them in your projects.
in Fundamentals
In this post, I would like to zoom in on pure functions and impure functions in Swift. These concepts may sound exotic, especially if you are unfamiliar with functional programming. I promise you that these concepts aren't as daunting as they seem.
in Programming
Swift has first-class functions and that opens up a lot of possibilities. In this post, we explore function types. We also cover named type and compound types.
in Fundamentals
Even though Swift isn't a functional programming language, it has first-class functions. What are first-class functions and what does that mean for the Swift programming language? Don't let yourself be thrown off by the term functional programming. The concepts we cover in this post are not difficult to grasp.
in Fundamentals