Tagged: Swift

There are 37 items tagged #Swift.
And there a lots of other tags to explore.

Getting the number of days between two dates in Swift

There are a few variations when dealing with counting days. You need to ask yourself some questions beforehand.

Understanding Date and DateComponents

Date and time might be among your list of the hardest things in programming (It is for me). Today, I'm going to talk about a basic concept of a Date and its companion DateComponents.

What is @escaping in Swift closures

Learn the meaning of @escaping, so you know what to do when you see it or when you need to write one.

Reduce boilerplate code with an automatic synthesis of Equatable and Hashable conformance

Equatable and Hashable are two essential protocols in the Swift world. Let's learn an old Swift feature that you might forget.

Setting default values for NSUserDefaults

NSUserDefaults is a go-to database for saving users' preferences. Learn how to populate it with your default values.

3 lesser-known ways of using Swift enums

Three language features around Swift enumeration that you might not aware of.

Testing delegates and protocols in XCTest

Learn how to write unit tests for delegate/protocol methods.

How to declare Swift protocol for a specific class

Learn how to create protocols that constrain their conforming types to a given class.

Sleep sort: A sorting algorithm without compare

I can't tell it is a stupid or genius algorithm, but it sure got a beauty in it.

Different ways to check for String suffix in Swift

Learn how to get a suffix from a Swift string.

Decode an array with a corrupted element

When working with an unstable, legacy, or third party API, you might get a malformed object in an array. Learn how to decode a JSON array with corrupted data in Codable safely.

How to set status bar style

Learn different ways to control the status bar style.

Different ways to check for String prefix in Swift

Learn how to get a prefix from a Swift string.

How to compare two app version strings in Swift

Learn how to check your app version strings are higher or lower.

How to split a string into an array of substrings in Swift

Learn different ways to split a string into an array of substrings.

How to make multi-line text in UIButton

The default appearance of UIButton is a single line text, but it also supports a multi-line text with some minor tweak.

History of Auto Layout constraints

Learn different ways to define Auto Layout constraints programmatically.

How to preserve a struct memberwise initializer when you have a custom initializer

A tip to declare a custom initializer without losing a memberwise initializer.

Memberwise Initializers for Structure Types

Struct is one of the basic building blocks in your app. Today I'm going to share some tips about memberwise Initializers.

SF Symbols: What is it, and how to use?

Introduction of SF Symbols, learn the basics, and how to use them.

Class-only Protocols: class or AnyObject

If you are still declaring class-only protocols by inheriting them from class, you might need to revise your knowledge.

How to read a Property List (plist) into the code

When I want to keep some information or configuration out of a code base and don't want something fancy, I usually save it as Property List file. Let's see how to do it.

Sign in with Apple Tutorial, Part 4: Web and Other Platforms

Part forth in a series Sign in with Apple. Use Sign in with Apple JS to let users set up accounts and sign in to your website and apps on other platforms.

Print unescaped string output in Swift

How to print object (po) in a debugger (lldb) without escape special characters.

Sign in with Apple Tutorial, Part 3: Backend – Token verification

Part 3 in a series Sign in with Apple. In this part, we will see how backend can use the token to sign up/sign in users.

What is @discardableResult

Learn about this Swift attribute and its purpose.

Sign in with Apple Tutorial, Part 2: Private Email Relay Service

Part 2 in a series Sign in with Apple. In this part, we will talk about the anonymous email address. How to make it work and its limitation.

Sign in with Apple Tutorial, Part 1: Apps

Part 1 in a series Sign in with Apple. In the first part, we will focus on the app part. What we need to do to add Sign in with Apple option in our app.

Swift Documentation

How to write documentation comments in your Swift code.

if let

How not to use it

SwiftUI's ViewModifier

Learn a crucial concept in SwiftUI, view modifier, and a guide of how to create your custom modifier.

How to use SwiftUI in UIKit

Using SwiftUI as UIView and UIViewController

How to use UIKit in SwiftUI

Using UIView and UIViewController in SwiftUI

MVC (Missing View Controller)

Where is UIViewController in SwiftUI?

Codable in Swift 4.0

Can it replace JSON encode/decode lib out there?

Where is my getter/setter in Swift?

A missing Objective-C piece

See all tags.