iOS Compiler directives in Swift This post is going to list some of the most frequently used compiler directives in Swift, compatible in Swift 3/4/5. Someone might call this preprocessor directives, but they Needone 9 Jan 2023 · 3 min read
Swift Present action sheet in UIKit and SwiftUI An action sheet is a component that displays a set of choices to the user in a modal format. UIKit In iOS, you can create an action sheet using a Needone 6 Jan 2023 · 1 min read
Swift What is keyword defer in Swift The defer keyword in Swift is used to execute a block of code at the end of the current scope, regardless of how the scope is exited. The defer block Needone 3 Jan 2023 · 1 min read
iOS Command pattern in Swift Many of us have heard about the Command pattern or used them in the development, which is a behavioral design pattern in which an object is used to encapsulate all Needone 31 Dec 2022 · 2 min read
Swift Have you tried XCTUnwrap before? What is XCTUnwrap and how to use it to help you effectively while you are doing the unit test? XCTUnwrap is a utility function that is used in unit tests Needone 29 Dec 2022 · 1 min read
Swift PLIST file in iOS A Property List (PLIST) file is a file format used by macOS and iOS to store serialized data. It is often used to store data such as user preferences, settings, Needone 25 Dec 2022 · 2 min read
Swift Create Property Wrapper in Swift What is Property Wrapper Property wrapper are a language feature that allows you to wrap a piece of code around a property in Swift world, which can help us to Needone 20 Dec 2022 · 1 min read
iOS Workplace, Project, Scheme and Target in iOS development Many of us have seen workspace, project, target and scheme quite often while doing the iOS development, but what are they exactly and how are they related with each other? Needone 17 Dec 2022 · 2 min read
Swift Equatable and Comparable in Swift It is quite common that we are required to compare two custom objects in Swift, luckily Swift has provided some built-in protocol allows us to do this in a "swift" Needone 14 Dec 2022 · 2 min read
Swift Difference between layoutIfNeeded vs. setNeedsLayout As many of iOS developer known, layoutIfNeeded and setNeedsLayout are two methods that can be used to update the layout of a view and its subviews. But what are their Needone 13 Dec 2022 · 2 min read
Swift Constructor Injection, Property Injection vs. Method Injection Dependency Injection is a design pattern that is providing another object with its dependencies, instead of having the object created or managed themselves. There are three main types of dependency Needone 12 Dec 2022 · 2 min read
Kotlin Type safe in programming language Introduction Type safety in programming languages refers to the concept that variables and data structures are strongly typed and cannot be assigned values of different types. This means that the Needone 9 Dec 2022 · 2 min read
iOS ContentHugging vs. ContentCompressionResistance in UIStackView In Swift, it is quite common to see ContentHugging and ContentCompressionResistance either when we are using the storyboard or code to render the user interfaces in UIStackView. Those 2 properties Needone 9 Dec 2022 · 1 min read
Swift A summary of use enum in Swift Enumeration type is a common type in many programming languages, which normally presents a set of limited status for a program, such as list all the directions for a compass: Needone 1 Mar 2021 · 2 min read
Swift Use Extension in Swift Extension is a great feature in Swift, which can help us to create helper/utility variables and method, and etc. Use extension to conform protocols It is quite common to Needone 27 Feb 2021 · 1 min read
iOS Property in Swift Unlike other programming languages, there are three types properties in Swift. Stored Properties They are constants or variables of a class, and part of the class instances that used to Needone 25 Feb 2021 · 1 min read
Swift Keyword Lazy in Swift lazy variables are variables will be computed until accessing. In other words, lazy variables won't have the real value until get called/used. As lazy variables can be re-assigned, so Needone 31 Dec 2020 · 1 min read
Swift Preview in SwiftUI Once you have finished the SwiftUI code, it is always a good idea to preview it before implement any function code. Luckily, such feature is natively supported by SwiftUI - Needone 19 Dec 2020 · 1 min read