Swift 6 introduces @MainActor
to the View protocol, enhancing the developer experience, but uncovering quirks like compile-time errors with @State
properties in modifiers. If you're adopting strict concurrency, this article can help explain the issue and provide practical solutions.
https://fatbobman.com/en/posts/why-certain-view-modifiers-in-swift-6-cannot-usethe-state-property/
#SwiftUI #concurrency
An excellent and clear example to understand how Noncopyable types work in Swift.
https://nilcoalescing.com/blog/NoncopyableTypesInSwift/
#Swift
🎓 Artem Novichkov has written a couple of interesting articles on integrating machine learning into an iOS project.
The first article explains how to analyze text using Apple's Natural Language framework. It focuses on detecting the language of the text and finding similarities between different pieces of text.
In the second article, Artem demonstrates how to train a machine learning model for sentiment analysis in languages not supported by existing frameworks. He uses CreateML to build a sentiment classifier model for Russian and Kazakh languages.
#ml #CreateML
I just noticed that a new modifier, onGeometryChanged
, has been backported to iOS 16 for retrieving a view's size. It looks like the use cases for GeometryReader
are becoming less frequent.
https://nemecek.be/blog/208/getting-view-size-in-swiftui-without-geometryreader
#layout #SwiftUI
The more developers transition to strict swift concurrency, the more valuable articles like this will become, where non-obvious bugs and their solutions are discussed. In this article, the author shared how he experimented with @unchecked Sendable
— describing a crash and how he fixed it, so we don't fall into the same trap.
https://jaredsinclair.com/2024/11/12/beware-unchecked
#Swift #concurrency
We use auto-generated passwords daily, but have you ever wondered how they're designed? Apple’s approach combines two-syllable patterns, symbols, and numbers to create strong, user-friendly passwords that are easy to remember and type, even on different keyboards, while maintaining high security (71 bits of entropy). With consonant-vowel patterns, these passwords are simpler to recall in short chunks, making them practical even for entry on unfamiliar or foreign keyboards.
https://rmondello.com/2024/10/07/apple-passwords-generated-strong-password-format/
#security
I came across an article on shared dictionary compression for network requests, which reduces the payload by transmitting only the changes instead of the full data each time. This technique is particularly useful for apps like calendars or news feeds, where most of the data remains the same between requests.
https://eisel.me/shared-dictionary-compression
It’s especially important because Amazon found that every extra 100ms of latency can reduce sales by 1%.
https://www.gigaspaces.com/blog/amazon-found-every-100ms-of-latency-cost-them-1-in-sales
#network #optimization
Java/Swift Interop is here, and no, this is not an April Fool's joke
https://github.com/swiftlang/swift-java
#Java #Swift
‼️ Friendly warning. Be aware of a crash in iOS 18 when using withCheckedContinuation
while building with Xcode 16. You can temporarily switch to withUnsafe*Continuation
to avoid the issue or build your app using Xcode 15 for now.
p.s. Seems like it’s only related to building an app for “My Mac (Designed for iPad)" destination
Active discussion: https://github.com/RevenueCat/purchases-ios/issues/4177
Apple radar: http://openradar.appspot.com/15099898
In a recent article, my buddy @artemnovichkov provides an insightful look into creating a GitHub Contribution Graph using Swift Charts. The piece delves into how developers can effectively leverage Swift Charts to build customizable, data-rich visualizations.
https://www.artemnovichkov.com/blog/github-contribution-graph-swift-charts
#SwiftUI #Charts
A short but insightful article on the non-obvious quirks of SwiftUI's Menu component. Jeff addresses common issues developers face when using HStack and VStack in Menu, offering practical solutions to overcome them.
https://jeffverkoeyen.com/blog/2024/08/16/SwiftUI-Menu-subtitle-shenanigans/
#SwiftUI
If you want to go beyond writing the usual tests we are all used to, there is a demonstration of how to automatically detect memory leaks in applications using UI tests on CI.
https://www.polpiella.dev/automatically-detect-memory-leaks-using-ui-tests/
#testing
Found a good article describing the nuances of using StateObject and ObservedObject.
https://www.mattmoriarity.com/2020-07-03-stateobject-and-observableobject-in-swiftui/
#SwiftUI
Xcode 16 brings a lot of updates - I want to share some of them that I find interesting:
- Predictive code completion
- Support for EditorConfig
- Explicitly built modules - more actionable error messages, improved debugger performance, and better scheduling decisions which maximize parallelism. LLDB can now import explicitly-built Swift and Clang modules directly
- A new code deduplication algorithm brings additional code size savings and an improved static link time performance
- New execution engine for Previews - shared build products between Build and Run and Previews, switching between the two is instant
- Previews now support previewing views inside of static libraries
- You can cut text from the Source Editor, and then use the “New File from Clipboard” to quickly extract part of a source file into a new file
- Buildable folder references - only record the folder path into the project file without enumerating the contained files. This minimizes diffs to the project when files are added and removed, and avoids source control conflicts with your team
- Swift-DocC now warns about documentation for parameters and return values that doesn’t exist for that documented API
- A lot features in Instruments
- Swift Testing - an all-new testing framework built for Swift from the ground up
#Xcode #wwdc
Author decided to explore the Attribute Graph - a key part of how SwiftUI updates the user interface. While the topic is advanced, it provides valuable insights for developers eager to dive into layout mechanism under the hood. 🤯
https://rensbr.eu/blog/swiftui-attribute-graph/
#SwiftUI #layout
🤖 Github just announced a new free tier of Copilot for VS code.
- 2,000 code completions per month
- 50 chat messages per month
- Models like Claude 3.5 Sonnet or GPT-4o
Copilot Free includes the following features: Code completion in Visual Studio Code, Visual Studio, JetBrains IDES, Vim/Neovim, Xcode, and Azure Data Studio
Xcode Previews are super handy, but let’s be honest — they crash a lot and small changes, like tweaking an Environment object or introducing a new dependency, can mess up other previews without you even realizing it. This blog from EmergeTools dives into a clever way to make them more reliable using unit tests.
https://www.emergetools.com/blog/posts/unit-test-xcode-previews
#SwiftUI #previews
👨💻 Apple has announced that App Store Connect will remain open for submissions during the upcoming holiday season.
https://developer.apple.com/news/?id=iwvebnw2
#Apple #news
Now is the perfect time to treat yourself and spend a little money wisely. 🤑
https://github.com/mRs-/Black-Friday-Deals
🔥 Xcode's LLM didn’t turn out to be very helpful for me, so the timing of Copilot's Xcode release is perfect!
https://github.com/github/CopilotForXcode
#AI #Copilot
⚠️ The Certification Authority for Apple Push Notifications (APNs) is changing soon. Sandbox servers update on Jan 20, 2025, and production on Feb 24, 2025. Make sure to update your app's Trust Store to include the new SHA-2 USERTrust RSA certificate to avoid any push notification issues.
https://developer.apple.com/news/?id=09za8wzy
#Apple
‼️ Friendly warning! There’s a sneaky malware campaign on Google Ads targeting apps like Slack, Notion, Calendly, and so on. These ads look legit but might lead to malware downloads that can steal your data! Stay safe, friends!
https://www.malwarebytes.com/blog/news/2024/10/large-scale-google-ads-campaign-targets-utility-software
🔨 Since Xcode 16 is now available, I’ve summarized some of the key features:
• Buildable folders. Great addition if you are tired of constant conflicts in your project file.
• New Tinted Icons. iOS 18 introduces dark and tinted app icons. Make your designers happy!
• Swift Strict Concurrency. Mode that helps you find and fix data races at compile time.
- Article about enabling the flag (SWIFT_STRICT_CONCURRENCY) in settings.
- Bunch of useful articles that will help solve all migration problems.
• Swift Testing. New library allows you to write tests with more confidence and less code.
- Tool for converting tests to the new format.
- Watch out for performance issues.
• Xcode Previews
- You no longer need to create a container for holding properties, thanks to a new macro.
- Note that Xcode 16 no longer sets ENABLE_PREVIEWS. It’s more reliable to use XCODE_RUNNING_FOR_PREVIEWS
• Editor Config. Finally, we can customize editor settings and share them across the team.
• Explicitly built modules. That makes builds faster and compiler errors more informative (though not always).
• Swift 6. New features are waiting for you to adopt!
and Friendly reminder to add iOS 18 to Introspect implementation. 🩷
Discovered one more way to theme applications using ShapeStyle
. It's 100% SwiftUI-way, doesn't involve UIColor.init(dynamicProvider:)
and can be achieved without using Xcode Asset Catalog (it’s not bad, but in case you want to programmatically initialize dynamic colors).
https://freiwald.dev/posts/custom-environment-colors/
#SwiftUI #appearance
When using a modular architecture, consider checking the ENABLE_MODULE_VERIFIER project setting. Disabling this flag can significantly reduce build times, especially in projects with a large number of modules. While it is useful for identifying issues with frameworks before distribution, it may not be necessary for most general projects.
https://pfandrade.me/blog/swift-build-times-and-module-verification/
#optimization #Xcode
It's a great idea to have quick answers about new features from WWDC, especially if you don't have the time to watch every session.
https://askwwdc.com/
#wwdc
In interviews, questions about the stack and heap are common, excpecially where is what object stored? You can impress the interviewers by discussing trivial types in Swift. Mention that you can use an underscored function to determine whether a type involves heap allocations and reference counting or not.
// POD - Plain old data
_isPOD(Int.self) // true
_isPOD(Array<Int>.self) // false
What a huge update with Swift 6 – it's packed with cool new features! A lot of the updates are all about making concurrency smoother and more efficient, which is super exciting. Plus, there are other great improvements and language tweaks that make coding in Swift even better.
https://www.hackingwithswift.com/articles/269/whats-new-in-swift-6
#Swift
Stephen and Brandon wrote an article to address common questions and misconceptions about the Composable Architecture (TCA). They aim to clarify its benefits, its relationship with SwiftUI, and its suitability for various apps. The article also tackles comparisons with Redux, and concerns about complexity, performance, and boilerplate code. Additionally, it discusses action modeling and state management efficiency within TCA.
https://www.pointfree.co/blog/posts/141-composable-architecture-frequently-asked-questions
#TCA #architecture
If you also thought that in VStask the default spacing value is always 8, then this article is here to clarify.
https://fatbobman.com/en/posts/spacing-of-swiftui/
#SwiftUI #Layout