#swift

Found 79 articles tagged with #swift

When to use computed properties or methods in Swift

Both computed properties and methods can provide dynamic behavior, allowing you to calculate values or perform actions based on the current state of an instance.

Feb 26, 2024#swift

How to capitalize first letter in Swift

Capitalizing first letter of each word, the first letter of a sentence, or all caps lies in the specific style and purpose of text presentation.

Jan 28, 2024#swift#strings

How to create a custom URLSession in Swift

It's important to consider the specific requirements of your tasks and choose the appropriate session type and configuration accordingly.

Jan 06, 2024#swift#network

How to compare two strings in Swift

One of the basic operations in Swift is to compare two strings for equality or order. There are different ways to do that, depending on your needs.

Nov 28, 2023#swift#strings

How to catch different errors in Swift

In Swift you cannot rely on the compiler to check the error type for you, you have to use runtime checks or type casting to determine what kind of error you are dealing with.

Oct 08, 2023#swift#errors

How to use lazy variables in Swift

This can be useful when the initial value of a variable is expensive to compute, or when it is not needed until it is actually used in the code.

Sep 27, 2023#swift

Difference between @objc and @nonobjc in Swift

In Swift, @objc is used to expose a method, property, or class to Objective-C, while @nonobjc is used to explicitly hide an entity from Objective-C.

Jul 25, 2023#swift#comparison

Difference between callAsFunction and @dynamicCallable in Swift

The main difference between callAsFunction and @dynamicCallable is that the former is more static and type-safe, while the latter is more dynamic and flexible.

Jul 23, 2023#swift#comparison

How to use xcconfig files in Xcode projects

You can create as many xcconfig files as you want, and you can specify different build configuration files for debug and release builds, and for different platforms and architectures.

Jul 21, 2023#xcode#swift#ios

Diferrence between Set and OptionSet in Swift

Set is a generic type that can store any type that conforms to the Hashable, OptionSet is a protocol that can be adopted by custom types that store a fixed-size sequence of bits.

Jul 18, 2023#swift#sets