Profile avatar
mecid.bsky.social
Swift Developer: iOS, watchOS, visionOS, tvOS, macOS. https://swiftwithmajid.com
156 posts 1,390 followers 575 following
Regular Contributor
Active Commenter

Every use of await keyword inside an actor type is a possible suspension point where other threads may access or mutate actor-isolated properties. You may have race conditions during actor reentrancy if you assume that actors always run code atomically. https://buff.ly/45XsNuP

How do you incorporate AI in your coding flow? Github Copilot + Xcode? VSCode + Cursor? Neovim + Cursor? Alex Sidebar?

Trigger value allows us to attach a logic that runs its action whenever the trigger value changes. You can find this pattern while using sensory feedback or launching keyframe animation in SwiftUI. https://buff.ly/4cIaqhq

SwiftUI Stunning Effect with Just 10 Lines ✨

Big changes are on the way. I’m not sure if they’re good or bad, but they’re happening.

We used to see SwiftUI views updating its body whenever the data it presents changes. TimelineView doesn’t follow this rule and allows us to build a super-custom schedule to update its content in a precise way. https://buff.ly/434UeV5

iOS Dev Weekly – Issue 700 (!!!!!) is out! iosdevweekly.com/issues/700/

Learn more about how the team behind Things, an award-winning personal task manager, rewrote their backend in Swift with a threefold reduction in compute costs: www.swift.org/blog/how-swi... @vapor.codes

Interesting, Xcode 16.3 beta is here. But there is no Swift Assist. It looks like it is abandoned. developer.apple.com/download/app...

The SwiftUI framework introduced the onGeometryChange view modifier, and I am happy to say that it is backward compatible with iOS 16. The onGeometryChange allows us to track geometry changes of any view in SwiftUI. https://buff.ly/3YJJjxQ

One of my favorite apps nowadays is Proposal Monitor - it really helps me stay on top of Swift Evolution proposals. A great example of a single-purpose tool that does its job really well. 10/10, no notes. 👏 #swiftlang apps.apple.com/app/id644944...

Debouncing simply means that you don’t start the task immediately and wait for some amount of time. You don’t start a task and wait until the data stays the same for some time. It allows us to eliminate unnecessary work for intermediate data and run only for final data. https://buff.ly/3CX5Fna

Still waiting for Xcode 16.3 beta.

Usually, you don’t need to manually yield tasks while using async functions, because every line where you use the await keyword yields the thread. The manual task yielding becomes really important whenever you use non-async APIs like JSON decoding and encoding, etc. https://buff.ly/3CX5Fna

This week we will talk about task yielding and debouncing. Swift concurrency language features provide us with two simple but very powerful functions: yield and sleep. We will try to learn how and when to use them.

The SwiftUI framework introduces the environment feature, implicitly allowing us to share data in the view hierarchy. The entry macro allows you to easily define not only environment values, but also transaction and container values. https://buff.ly/3VYclGR

The Task type provides us with the isCancelled property, which is a boolean value indicating whenever the task is cancelled. You can check it whenever needed to decide how to model your next steps. https://buff.ly/3Ez8VFC

Anyone with MBP M4 Pro here?

Anybody noticed the strange sounds coming from the inside of MBP after the latest macOS update whenever predictive completion works in Xcode? or something wrong with my MBP?

Cooperative cancellation means that Swift will never stop your task automatically, but it will provide you with information about the cancellation. It is totally up to you to decide how to handle this information. https://buff.ly/3Ez8VFC

I sometimes forget the steps to test state restoration with Xcode and think my code is broken. We have to press Home on the simulator before stopping the app for SceneStorage to save the value. Wrote a short post with the steps for a quick reference: nilcoalescing.com/blog/Testing... #iOSDev

Swift Concurrency provides a cooperative cancellation model to handle task cancellation. This week, we will learn what a cooperative cancellation model is, how to use it, and how to be a good citizen and handle it correctly.

If we want to present a sheet on top of another sheet in #SwiftUI, we have to attach the second sheet() modifier inside the content of the first sheet view, otherwise it won't work properly and SwiftUI will complain that only presenting a single sheet is supported.

I build paywalls using StoreKit 2 in my apps. It is almost 100 lines of code that you need to provide subscription-base functionality. It doesn't provide you a/b testing, but you can go further and implement it yourself. https://buff.ly/44PV8mp

Dive into performance measurement in Swift with OSLog and os_signpost. Learn how to identify bottlenecks and improve app efficiency https://www.donnywals.com/measuring-performance-with-os_signpost/

I’ve created an example project to illustrate the performance issue. You can explore it here. github.com/mecid/swiftu...

The formatted function is part of the many Swift Foundation types? But we can easily define the same formatted function on our types and reuse the FormatStyle protocol. I use this approach to encapsulate and reuse formatting logic for my own model types. https://buff.ly/3xFHFSN

Looking for a SwiftUI performance expert! This single line has a huge impact on the performance. Why SwiftUI updates DateView's body even when values don't change? The equatable view modifier solves the issues.

Task groups allow us to cancel the group and deliver partial results when needed using cancelAll function on the TaskGroup type. https://buff.ly/4gqgefV