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 to unwrap optional values. It is part of the XCTest framework, which is the default testing framework for iOS and
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, and other information that needs to be stored persistently. PLIST files can either be stored in a binary format and
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 add additional behavior or functionality to that property. The benefits of it is to reduce the code repetition. Property wrapper
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? Workplace Workplace in Xcode is a tool for managing and organizing your project files. It allows you to easily navigate
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" way. Equatable In Swift, Equatable is a protocol that allows us to determine whether two reference objects are
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 differences? Today's article will help this out: LayoutIfNeeded layoutIfNeeded is a method that forces the view to immediately
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 injection: constructor injection, property injection, and method injection. Constructor injection As the name indicated, constructor injection is passing the dependencies
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 determine how a view can automatically adjust its size with the content give, such as dynamic & long text, images
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: enum CompassPoint { case north case south case east case west } However, enum provides more features than that: 1. Static values
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 use protocols in any project, with extension, we can make the code more organized. extension CollectionViewController: UITableViewDelegate, UITableViewDataSource { // necessary methods
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 store values. One of the examples is the model class. class Car { var name: String var price: Float = 0.0
iOS How to check whether a mobile device is muted or not on iPhone/iPad On iOS devices, there are mainly two types of sounds: * Ringtones and reminders: Including system sounds such as phone calls, text messages, notifications (also including key tones, lock sounds, which can be set in the settings to enable or disable), they are controlled by the physical mute switch key, that
iOS Init vs Convenience init in Swift Initializers, also known as constructors in other programming languages, have two types: Designated init and Convenience init. They are used to initialize properties or customize a variable or object for classes or structs. Designated init This type of the Initializer is frequently seen in Swift class, also named as primary
iOS iPhone/iPad Redeem promo code to get free App in 2022 This will happen when developers decides to give out some free apps, which sometimes you will see the promo code like this EAJXJEXL7MJH. As many of you might know how to redeem that code on App store, but there still someone are pretty new to it. In order to redeem
iOS Days Gone Widget Dear time master, Thanks for downloading this app. Time travels fast, with days gone app we can put a nice-looking widget on your Home Screen so we would know where you are during the year. So displays the yearly progress as a widget. Features: * Support 10 color schemas * Super easy
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 it can't be used on constants which normally defined by let. One example of using lazy
iOS Constants in Objective-C Recently I was working on a legacy project written in Objective-C, which reminded me of the early days when working on Objective-C projects. In the code I saw few things like the following which defines a constant: #define car_price 300 #define creates a macro which simply do the replacement
iOS How to use Swift Package Manager What is Swift Package? According to Apple's doc: * Swift packages are reusable components of Swift, Objective-C, Objective-C++, C, or C++ code that developers can use in their projects. They bundle source files, binaries, and resources in a way that’s easy to use in your app’s project.
iOS VIP Architecture in Swift with easy explanation Recently I joined a project where the architecture follows the Clean-Swift VIP Pattern. This article is an overview and some thoughts from a mobile developer’s perspective who have NEVER touched the VIP architecture before. This article will show the basic concepts of VIP Architecture and how are they work,
iOS SwiftLint: Writing good quality code in Swift SwiftLint is a programming guide tool which can automatically check the code quality with certain rules such as https://github.com/github/swift-style-guide. The article will cover: * How to install and configure SwiftLint * How to use SwiftLint * Customise SwiftLint rules SwiftLint installation There are two ways of installations that we
iOS What is Bitcode in iOS You may compile and build iOS app using Swift and/or Objective-C every day, and you've probably you heard of Bitcode multiple times. So what exactly is the Bitcode, as some of you might see the configuration in the build phrase (Target -> Build Settings ->
iOS iOS14: How to show all your photos on WhatsApp iOS14: How to show all your photos on WhatsApp, instagram, facebook
iOS Extract the debug or crash log from iPhone/iPad For Real devices 1. Open Settings app 2. Tap Privacy 3. Tap Analytics & Improvements 4. Tap Analytics Data 5. There might be quite a lot of Data, so try to pinpoint the possible one using date: 6. Tap the Share button at the top right corner, you can share