#swift

Found 83 articles tagged with #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

Unlocking the Power of Macros in Swift 5.9

Macros are a feature present in a number of languages that allow one to perform some kind of transformation on the program's input source code to produce a different program.

Jun 19, 2023#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 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 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 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