#swift

Found 88 articles tagged with #swift

Data Race vs Race Condition in Swift

A data race is when two threads access the same mutable object without synchronization, while a race condition is when the order of events affects the correctness of the program.

May 24, 2023#swift#concurrency

How to filter unique items of an array in Swift

If you don’t care about the order, you can use a Set or Dictionary to remove any duplicates, and then convert it back to an array.

Swift Dynamically Callable Types

The attribute dynamicCallable allows you to mark a type as being directly callable, then you can use a simpler syntax to invoke methods on that type, instead of using dot notation.

Apr 20, 2023#swift

Swift Dynamic Member Lookup Types

The @dynamicMemberLookup attribute enable you to access properties of a type that are not declared at compile time, but resolved at runtime.

Apr 20, 2023#swift

Swift callAsFunction

A special method that allows you to call an instance of a type as if it were a function, useful for creating callable objects that encapsulate some logic or state.

Apr 17, 2023#swift

iOS Interview Questions (UIKit)

UIKit is a framework that was introduced by Apple in 2007 alongside the original iPhone. Today, UIKit remains a crucial part of the iOS development toolkit and is used by developers worldwide.

Apr 14, 2023#ios#swift#uikit

How to encode and decode JSON data in Swift

With Codable, you can easily convert Swift objects to data representations and vice versa, without having to write complex serialization and deserialization code.

Apr 08, 2023#swift#how-to

Swift KeyPath vs #keyPath()

Swift key paths are a way of storing uninvoked references to properties, which is a fancy way of saying they refer to a property itself rather than to that property’s value.

Apr 07, 2023#swift

Swift Conditional Compilation for Attributes

Using conditional directive hasAttribute to simplify code that needs to be conditionally compiled based on the presence or absence of certain attributes.

Apr 03, 2023#swift

Swift actor isolated vs nonisolated

Swift actor isolation is a feature of Swift concurrency that allows actors to protect their state from concurrent access by other actors or….

Apr 02, 2023#swift#concurrency