Sponsored Link
RUNWAY
Do your mobile releases involve a near-endless pile of manual tasks and different people repeatedly asking each other βWhatβs the status of the release?β
Donβt just roll over and accept this death by a thousand branch cuts.
Swift Around the Web
Copy On Write and the Swift-CowBox Macro
The article delves into the concept of Copy-on-Write (COW) in Swift, utilizing the Swift-CowBox macro. COW enhances memory efficiency by deferring the copying of structs until it's absolutely required.
The discussion covers the implementation of COW, outlining its benefits, such as performance optimization and seamless protocol support. Additionally, the article addresses important considerations and encourages further exploration of the topic.
How to keep Dateβs microseconds precision in Swift
To preserve microsecond precision when parsing ISO8601 formatted dates in Swift, the standard ISO8601DateFormatter
is insufficient, as it discards microseconds during conversion. This limitation can pose challenges in scenarios where precise time tracking, such as sorting or time-sensitive calculations, is required.
A solution to this problem is to extend the ISO8601DateFormatter
with a custom method that manually extracts microseconds from the string and incorporates them into the parsed date. By handling the microseconds separately, this approach ensures the date is accurately represented with full precision, maintaining the integrity of microsecond-level details.
Swift Evolution
Swift Evolution is a collaborative platform where developers can contribute to the ongoing development and improvement of the Swift programming language. It provides a transparent process for proposing, discussing, and reviewing potential changes and enhancements.
Why will you like it:
- Stay updated on the latest proposals for Swift's evolution.
- Join the community in discussing and refining potential changes.
- Help shape the future of Swift by reviewing and voting on proposals.
- Submit your own proposals and ideas for improving Swift.
By participating in Swift Evolution, you can actively contribute to the growth and success of the Swift programming language.
Coding
How to listen for property changes in an @Observable class using AsyncStreams
Two methods for observing property changes in an @Observable class: Combine and AsyncStreams.
Combine uses @Published properties and $ prefix for observation. AsyncStreams use willSet or didSet observers and AsyncStream for complex operations.
The article recommends AsyncStreams for their natural fit with async/await.
Calculating the semantic distance between words with the Natural Language framework
The NLEmbedding
class in Swift's Natural Language framework calculates semantic distance between words, allowing for synonym detection.
The article showcases using NLEmbedding
to find synonyms and includes a SwiftUI view example where users can input a word to see its synonyms in real-time.
Creating a Custom Navigation Bar in SwiftUI
To create a custom navigation bar in SwiftUI, a ZStack
is used for the layout, allowing for flexible positioning of elements like leading and trailing buttons. By utilizing generics, the design can accommodate different types of content, making the navigation bar highly customizable.
The article provides an example of implementing this custom navigation bar within a SwiftUI view, helping developers craft a more unique and branded appearance for their app's user interface.
Apple News
A Cozy WWDC
"Cozy WWDC" event that focused on visionOS.
It was an exclusive event with only 170 developers, featuring live presentations, code demos, a Q&A session, and networking opportunities.
Design
Building a Custom Progress Bar in SwiftUI
Another excellent article by Peter Yaacoub guides you through building a custom progress bar in SwiftUI, ideal for mobile apps. It explains the code used in the Catzumi app, showcasing a progress bar that provides:
- Adaptive Sizing: Adjusts to different screen sizes using GeometryReader.
- Visual Clarity: A filled rectangle with a clear border indicates progress.
- Numerical Clarity: Text displays the current and maximum values for precise information.
Applying visual effects combined with scrolling in SwiftUI
This article shows how to enhance SwiftUI views with scrolling visual effects. By using the visualEffect(_:)
modifier and GeometryProxy
, you can create dynamic effects such as color transitions and scaling during scrolling.
The article showcases examples using ScrollView:
- Vertical Scroll with Hue Rotation: Elements change hue based on vertical position, creating a color gradient.
- Horizontal Scroll with Combined Effects: Circles dynamically change size, color, and brightness depending on their distance from the center of the screen.
Other Cool Stuff
How does the whole @preconcurrency thing work?
This article explores the @preconcurrency
attribute in Swift, which helps manage concurrency-related issues. It has three primary uses:
- Allows isolated types to conform to non-isolated protocols.
- Make APIs compatible with both Swift 5 and Swift 6.
- Help to resolve compiler errors related to non-sendable types.
While @preconcurrency is a powerful tool, it's essential to use it cautiously and understand its limitations.
Security-scoped bookmarks for URL access
Antoine discusses security-scoped bookmarks in macOS, which enable storing access to user-selected URLs. The post highlights a bug in macOS Sequoia that may impact their functionality and provides a workaround.
Additionally, it explains how to implement security-scoped bookmarks and shares tips for enhancing iOS app performance.
In Case You Missed It
AVAudioEffectNode: painless low-level audio effects written in Swift
Learn how to create custom audio effects using AVAudioEffectNode
in Swift. The article covers defining an AudioComponentDescription
, creating a custom AUAudioUnit
subclass, and implementing a render block.
It also provides an example of a symmetrical clipping effect and explains how to connect various nodes within an AVAudioEngine
.
Freebies
FREE - iOS Dev Launchpad
An introduction to the world of iOS Development. You will learn the basics of Swift, Xcode and build beginner apps.
FREE - SwiftUI Fundamentals
An introduction to SwiftUI. We start off easy and gradually get more difficult over the course of 4 apps.
FREE - iOS Dev Job Interview Practice
You will learn the fundamentals required to get your first iOS developer job. If you have an understanding of the concepts taught in this course, you're ready to start applying for jobs.