Spent my Friday evening exploring the new @pointfree.co TCA26 beta, connecting it to skip.tools to get the framework working on Android.
A single #swiftlang codebase, native #SwiftUI and #JetpackCompose components, and the Composable Architecture all together? THE FUTURE IS NOW
Posts by Point-Free
Which code do you want to maintain?
Do you really want to go through 'withLock' every time you need to access state? Wouldn't it be better to just get synchronous access to your state with no ceremony?
That's what actors give us!
www.pointfree.co/episodes/ep3...
You may wonder why it took us 5 episodes in our “Isolation” series to get to actors, but we needed to understand locks first. There's some misunderstanding in the Swift community about how actors compare to locks, and we want to clear the air.
👉 www.pointfree.co/collections/...
Actors finally enter the stage in our series exploring “isolation” in Swift. We will compare actors to locking and mutexes to find they are a breath of fresh air (mostly). Learn why: www.pointfree.co/episodes/ep3...
A Sendable error in Swift.
Sendability errors in Swift might make you wonder if you should be adding “Sendable” to all your types. It seems innocent enough, and don’t we want all our types to be concurrency-safe?
The answer: an emphatic NO!
Take great care making a type sendable 👇
It will be free for all eventually!
And we're up and running with a simple TCA 2.0 bluesky client. Just hitting some of the public endpoints to load a feed!
No auth yet, but I just did an auth0 integration a few months ago, so it should be straightforward 🤞
#atProto #swiftlang #swiftUI @pointfree.co
Haha well technically we did post on 4/1 but may not have made it to your side of the world until 4/2 :)
Swift's Mutex is the modern way to lock state. It relaxes many constraints while still keeping things thread safe.
But there's a serious bug. You can escape a non-sendable object from the mutex to multiple threads and cause runtime crashes.
Learn more: www.pointfree.co/episodes/ep3...
We have a brand new open source project we are working on, and for the first time we are giving people a very early peek.
It's a library that brings exhaustive testing tools to difficult-to-test types, such as reference types.
www.pointfree.co/blog/posts/2...
The future is now! #swift
Read all about it in our announcement post: www.pointfree.co/blog/posts/2...
We’re releasing ComposableArchitecture 2.0 as a Beta Preview, as well as a brand new library: www.pointfree.co/beta-previews
ComposableArchitecture 2.0
We are announcing something BIG today!
Planning out a new app to start working on and @pointfree.co once again has done a tremendous amount of heavy lifting for me, this time with github.com/pointfreeco/... supporting CloudKit
Mutex improves on OSAllocatedUnfairLock in two ways:
• It is more flexible by using the 'sending' keyword to safely pass non-sendable objects in and out
• It is more strict since there is no lock() or unlock() method
Learn all about it:
www.pointfree.co/episodes/ep3...
We explore the most modern locking primitive in Swift: Mutex. It has some serious smarts when it comes to protecting nonsendable state across threads in a synchronous manner, but it also has a serious bug that you should be aware of.
👉 www.pointfree.co/episodes/ep3...
OSAllocatedUnfairLock has two initializers: one requires Sendable, the other is unchecked. A 3-line extension using @Sendable @autoclosure gives you a safe way to protect non-sendable state.
Learn this trick and more in this week's episode: www.pointfree.co/episodes/ep3...
Have you tried SQLiteData yet?
github.com/pointfreeco/...
OSAllocatedUnfairLock ships two initializers: one too strict (requires Sendable), the other unchecked. A 3-line extension using @Sendable @autoclosure gives you a safe middle ground for non-sendable state.
Learn this fun trick in this week's episode: www.pointfree.co/episodes/ep3...
NSLock was built before Swift concurrency so its API has no sendability annotations, making it easy to write unsafe code.
OSAllocatedUnfairLock is a modern replacement that uses sendability to express that you cannot capture nor return non-sendable state from it.
Some hard data on a successful conversion of a Core Data app to SQLiteData. Crashes go 📉
iCloud collaboration is a major selling point for apps, so don't leave that functionality on the ground!
SQLiteData makes it incredibly easy for your users to share records with other iCloud users. It truly only takes a few minutes to implement!
👉 github.com/pointfreeco/...
NSLock and OSAllocatedUnfairLock both have a 'withLock' method, but they are completely different.
The former is mere sugar around lock+unlock, and the latter actually protects state by wrapping it and using sendability attributes.
You might think @unchecked Sendable is a localized escape hatch, but it opens the floodgates for data races in unrelated code.
This week we show how it caused a crash in a completely different class that was never marked as unchecked sendable. How??
www.pointfree.co/episodes/ep3...
Isolating state with an NSLock is not as straightforward as it seems, and we showed a subtle data race. But Apple provides a more modern tool that helps prevent this data race at compile time. Let’s take it for a spin and understand how it works.
👉 www.pointfree.co/episodes/ep3...
Big release for Snapshot Testing: full support for Swift Testing attachments!
🎉 github.com/pointfreeco/...