Observing changes in Core Data NSManagedObject instances with Combine publishers can be a great solution to keep your user interface in sync with the latest changes. After reading through my posts in the Combine and Core Data categories, you might know more about those individual frameworks, but how do you “combine” them together? Techniques like …
Search Results for: A00-282 Schulungsangebot 🍃 A00-282 Dumps 🆘 A00-282 Echte Fragen 🌕 ➥ www.itzert.com 🡄 ist die beste Webseite um den kostenlosen Download von ➤ A00-282 ⮘ zu erhalten 🛃A00-282 Tests
Getting started with the Combine framework in Swift
Combine was introduced as a new framework by Apple at WWDC 2019. The framework provides a declarative Swift API for processing values over time and can be seen as a 1st party alternative to popular frameworks like RxSwift and ReactiveSwift. If you’ve been trying out SwiftUI, you’ve likely been using Combine quite a lot already. …
How to test optionals in Swift with XCTest
Optionals types in Swift either have a value or not, and there are several ways to test optionals using the XCTest framework. APIs like XCTUnwrap are designed to unwrap an optional and throw an error if unwrapping failed. However, it can easily lead to writing many unwraps before evaluating the actual outcome you want to …
How to use the rethrows keyword in Swift
Rethrows in Swift allows forwarding a thrown error by a given function parameter. It’s used a lot in methods like map, filter, and forEach and helps the compiler to determine whether or not a try prefix is needed. In my experience, you don’t have to write rethrowing methods that often. However, once you know how …
How to use @autoclosure in Swift to improve performance
@autoclosure in Swift is a type of closure that allows to omit braces and make it look like a normal expression. Under the hood, however, it’s still a closure. By understanding what this means, we can improve the efficiency of our code. The @autoclosure keyword might be new to you. For many of us, it’s …
How to create a Dynamic Pager View for onboardings
A pager view in SwiftUI like we know UIPageViewController in UIKit didn’t exist until iOS 14 and macOS 11.0. Using the PageTabViewStyle on a TabView will result in a swipeable set of pages. However, what if you want to support iOS 13? And how would you do something similar on macOS Catalina? On top of …
XCTExpectFailure: Expected test failures explained with code examples
XCTExpectFailure was introduced in Xcode 12.5 and allows marking test failures as expected. The first time I read about this new API I was kind of confused: why wouldn’t we use methods like XCTAssertThrowsError instead? I continued my journey and quickly realised this API is a welcome addition to the XCTest framework. In fact, it …
Closures in Swift explained with Code Examples
Closures in Swift can be challenging to understand with types like trailing closures, capturing lists, and shorthand syntaxes. They’re used throughout the standard library and are part of the basics you need to know when writing Swift code. Xcode will help us most of the time with the right syntax using autocompletion but it’s good …
What is a Computed Property in Swift?
Computed properties are part of a family of property types in Swift. Stored properties are the most common which save and return a stored value whereas computed ones are a bit different. A computed property, it’s all in the name, computes its property upon request. It can be a valuable addition to any of your …
SwiftLee 2020 In Review: Most read blog posts
Every year I’m looking back at what I achieved with SwiftLee as well as what I want to achieve in the upcoming year. I did this in 2018, 2019, and I’m doing the same in this blog post for 2020. 2020 is definitely not comparable to the years before due to COVID and all its …