Majid Jabrayilov

@Mecid
1.9K Followers
141 Following
8.1K Posts
Swift developer 👨🏻‍💻SwiftUI addicted 🚀Creator of CardioBot app for⌚️and📱Writing weekly posts about Swift development 📖
SwiftUI Weeklyhttps://weekly.swiftwithmajid.com
GitHubhttps://github.com/mecid
CardioBothttps://cardiobot.swiftwithmajid.com
Bloghttps://swiftwithmajid.com
The first variant looks simple, but as soon as it fails, it will be difficult to understand what values cause it to fail. Fortunately, Xcode's Test Navigator clearly shows you which argument fails your test whenever you use the parameterized tests.
https://buff.ly/3AsDBXz
Introducing Swift Testing. Parameterized Tests.

I decided to finalize the topic of the Swift Testing framework with its unique feature called parameterized tests. In a few cases, you need to verify your functions with different inputs, and parameterized tests easily solve this by providing you with a nice overview.

Swift with Majid
By default, the Swift Testing framework uses a combination of all available parameters and runs our test 25 times with different combinations. Fortunately, we can change it by using the zip function, the Swift Testing framework pairs the arguments and runs our test 5 times.
https://buff.ly/3AsDBXz
Introducing Swift Testing. Parameterized Tests.

I decided to finalize the topic of the Swift Testing framework with its unique feature called parameterized tests. In a few cases, you need to verify your functions with different inputs, and parameterized tests easily solve this by providing you with a nice overview.

Swift with Majid
Using rules, parameters, events, and options, we can customize the logic that decides when to display your tips. In this example, we display tips only after onboarding.
https://buff.ly/4dF8OW8
Discovering app features with TipKit. Rules.

This week, we will continue discussing how to highlight app features using the TipKit framework. TipKit provides a flexible way of customizing the condition under which tips should appear.

Swift with Majid
The Test and Suite macros allow us to enable a trait or set of traits related to the test or test suite and pass built-in trait types. For example, it might be useful to skip tests for features disabled by a particular flag.
https://buff.ly/3O0J0YJ
Introducing Swift Testing. Traits.

The most powerful feature of the Swift Testing framework is the trait system. Traits allow us to annotate a test or test suite to customize its behavior. This week, we will learn how to use built-in trait types to modify tests.

Swift with Majid
I’m 33.
We use the Window scene type to define a single window assigned to a particular identifier. Now we can use the openWindow environment value to open a window with the dedicated identifier.
https://buff.ly/4c6FPIL
Window management in SwiftUI

One of the significant additions to the current iteration of the SwiftUI framework was window management APIs. We can open a separate window using the new environment APIs and create a menu bar app using the new scene APIs. This week we will learn how to use new window management APIs in SwiftUI.

Swift with Majid
Swift Testing calls the init function before every test case. We can use the init function to set up a database connection, preload mock data, etc. Whenever you need the teardown function to run after each test case, you can use deinit.
https://buff.ly/3AqyWoM
Introducing Swift Testing. Lifecycle.

Any function marked with the @Test macro can be a test in the world of the Swift Testing framework. But how do you handle the lifecycle of the tests? How do you define test suites and provide setup and teardown functionality? This week, we will learn how to handle the test lifecycle in Swift Testing framework.

Swift with Majid
We define the bmr constant and initialize it inline with the switch expression. We win back local reasoning by guaranteeing that the switch expression provides the initial value to our constant.
https://buff.ly/3ViuQGT
If and switch expressions in Swift

One of the silent changes in Swift 5.9 was if and switch expressions. I only saw a little about this option, but it can improve your code in many ways. This week, we will learn about if and switch expressions in Swift.

Swift with Majid
Microapps architecture allows you to enhance the separation of concerns in your codebase. Swift Package Manager became the heart of this approach. It allows us to extract every feature into a separate Swift module and reduce the compile time of your project.
https://buff.ly/3D2Zbzf
Microapps architecture in Swift. SPM basics.

This week I want to start a series of posts about the new approach I use to build scalable apps in Swift. Microapps architecture allows you to reduce the compile-time and enhances the separation of concerns in your codebase. Teams can produce a module per feature and run it as a separate app to improve the value delivery.

Swift with Majid
Assume that you have a throwing function that might throw an error in a particular case and want to test that behavior. You can still use the expect macro to verify the error throw.
https://buff.ly/3Ufzdle
Introducing Swift Testing. Basics.

Swift Testing is a new framework with expressive and intuitive APIs that improve your testing experience. It is powered by macros that allow you to organize and assert your tests. This week, we will learn about the basics of the Swift Testing framework and how we can use it side-by-side with XCTest.

Swift with Majid