サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
アメリカ大統領選
www.avanderlee.com
Reflection in Swift allows us to use the Mirror API to inspect and manipulate arbitrary values at runtime. Even though Swift puts a lot of emphasis on static typing, we can get the flexibility to gain more control over types than you might expect. I’ve been planning to explore the Mirror API for a long time, but I always had a hard time coming up with a use-case for it. Though, as you might expect
RunLoop.main and DispatchQueue.main are often used as schedulers within Combine. During code reviews, I often encounter inconsistency in using one or another, which made me realize it’s not always clear what the differences are. You might be surprised by the outcome of this article! While you can use both RunLoop.main and DispatchQueue.main in different scenarios, I will focus on its usage within
Development Assets in Xcode allow you to provide test data to use within SwiftUI previews and other code during development. Assets marked for development will only be included in debug builds and removed once you create an archive of your app. Without being aware of development assets, you might have added a few smaller images to your app’s Asset Catalog to be able to have a little nicer SwiftUI
Dependency Injection is a software design pattern in which an object receives other instances that it depends on. It’s a commonly used technique that allows reusing code, insert mocked data, and simplify testing. An example could be initializing a view with the network provider as a dependency. There are many different solutions for dependency injection in Swift, which all have their own pros and
An NSBatchDeleteRequest can be used to efficiently delete a batch of entries from a Core Data SQLite persistent store. It runs faster than deleting Core Data entities yourself on a managed object context as they operate at the SQL level in the persistent store itself. Its usage, however, is a bit less simple compared to the usual delete method which you can use on a managed object context. So befo
SwiftLee Stay updated with the latest in Swift & SwiftUI Join 19,806 Swift developers in our exclusive newsletter for the latest insights, tips, and updates. Don't miss out – Join today:
Build performance can be analyzed in Xcode to speed up your builds. This can quickly speed up your workflow and save a lot of time during the day for all developers working on the project. Slow builds often distract us as they enable us to focus on distractions like social media and Slack. By investigating your build performance and investing some time to improve where possible, you’ll see that yo
OSLog is a replacement for print, and NSLog and Apple’s recommended way of logging. It has different logging levels, like debugging, warning, and error logs. Altogether, it allows you to create an enriched logging experience fitting nicely in Xcode 15’s new logging console. OSLog has a low-performance overhead and is archived on the device for later retrieval. You can read logs using the external
Launch screens appear when your app starts up and give the user the impression that your app is fast and responsive. After your app is loaded it will be replaced with your app’s first screen after which the user can start using your app. Xcode creates a storyboard by default which you can use to set up your loading screen. Although this works fine in most cases, there are exciting new options avai
Testing push notifications in the iOS simulator make adding support for remote notifications much more effortless. You often must iterate a lot to verify that your code is working as expected. After gaining permission to receive push notifications in your app, you can start testing out several notifications. Xcode’s Simulator supports testing both regular and Rich Notifications, depending on the J
The Thread Sanitizer, also known as TSan, is an LLVM based tool to audit threading issues in your Swift and C language written code. It was first introduced in Xcode 8 and can be a great tool to find less visible bugs in your code, like data races. At WeTransfer, the Thread Sanitizer helped us solve flaky tests and weird crashes that we couldn’t really pinpoint to a certain cause. You might not ha
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. Types like ObservableObject and Property Wrappers like @Published all
Property Wrappers in Swift allow you to extract common logic in a distinct wrapper object. This new technique appeared at WWDC 2019 and first became available in Swift 5. It’s a neat addition to the Swift library that allows removing much boilerplate code, which we probably all have written in our projects. You can find a background story on property wrappers on the Swift forums for SE-0258. Whil
このページを最初にブックマークしてみませんか?
『A weekly Swift Blog on Xcode and iOS Development』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く