Got an issue trying to access a singleton from a swift package. It gives me this error: "Class property 'shared' is not a member type of
'UserPreferences'"
Anyone know why this might be the case when it works perfectly fine when accessing it from within the package itself? Package is based on Swift 5.9 and on Xcode 15 beta 5.
#swift #SwiftLang #swiftui #iosdev #ios17
Come a little bit closer baby
Get it on, get it on
‘Cause tonight is the night when two become one
How many differences can you spot? 🤭 #Xcode #SwiftStudio #swiftlang #swift
#xcode #swiftstudio #SwiftLang #swift
Let's add microtests to existing code!
I'll be #LiveCoding 13 hours from now on https://www.twitch.tv/qcoding, working on the TripService #LegacyCode kata in #Swift. #UnitTesting #SwiftLang
#livecoding #LegacyCode #swift #UnitTesting #SwiftLang
How can you write #XCTest assertions to verify #Swift optionals, getting the most from failures? #SwiftLang #UnitTests https://qualitycoding.org/unit-test-optionals-swift/
#xctest #swift #SwiftLang #unittests
Let's add microtests to existing code!
I'll be #LiveCoding 1.5 hours from now on https://twitch.tv/qcoding, working on the TripService #LegacyCode kata in #SwiftLang. #Swift #UnitTesting
#livecoding #LegacyCode #SwiftLang #swift #UnitTesting
Suddenly, AppCode Is Dead. Now What? #AppCode #Xcode #iOSDev #Swift #SwiftLang https://www.industriallogic.com/blog/appcode-is-dead/
#appcode #xcode #iosdev #swift #SwiftLang
Let's add tests to existing code!
I'll be #LiveCoding 2.5 hours from now on https://twitch.tv/qcoding. I'll be looking at some real-world #Swift #SwiftLang #LegacyCode ("legacy" meaning "without tests"). #UnitTesting
#livecoding #swift #SwiftLang #LegacyCode #UnitTesting
ViewControllerPresentationSpy now updated for Xcode 14 support.
This is the easiest way to microtest #UIKit view controller presentation and dismissal. #SwiftLang #iOSDev #UnitTesting #UnitTests
https://github.com/jonreid/ViewControllerPresentationSpy/releases/tag/v7.0.0
#unittests #uikit #SwiftLang #iosdev #UnitTesting
Update on my battle between swizzling and #SwiftLang's new concurrency rules. It took 3.5 hours, but I finally found a workaround.
Where I had
private static func swizzleMocks() {…}
I now have
private nonisolated static func swizzleMocksIgnoringActorIsolation() {
perform(#selector(swizzleMocks))
}
@objc private static func swizzleMocks() {…}
I'm skirting around Swift by doing a perform selector via the Obj-C runtime.
Besides that, I declared the test spies as MainActor, and also the test suites.
Secure your data in Keychain in Swift. New post is out! Don’t miss it! 😉
#iosdev #swift #SwiftLang
Just had a great time mentoring someone who wanted to learn outside-in #TDD. We went from a tap on a table view cell to a "present the detail" protocol. The test used a spy, but the real code wanted the skeleton of the real presenter.
Then we TDD'd the presenter, confirming it pushed a detail view controller to a navigation spy.
The rest is TDDing that the new view controller actually shows the detail info. #SwiftLang #iOSDev
Holy crap #SwiftLang, your zeal for correctness over ease-of-use is killing me… I had working code that is now broken, with no changes from me.
My previously fine static func now leads to errors. Fine, I'll mark my stuff as MainActor. Happy?
No. Because now you say I can't call my cleanup from deinit, since the cleanup is MainActor but deinit might be called from any thread. But it is, that's how I use it. It cleans up after itself. This is a useful pattern. Let me through, dammit!
I've drafted a blog post about the death of #AppCode. Will hold onto it until the new year. Subheadings:
- What Killed AppCode?
- Swift Refactorings We'll Now Never See in AppCode
- What's the Future of #Refactoring and Code Generation in #SwiftLang?
#appcode #refactoring #SwiftLang
How do you test a custom test assertion? It depends. Usually, by hand, unless… #SwiftLang #XCTest https://stackoverflow.com/a/74880885/246895
Writing microtests for a #SwiftLang CancellableImageLoader. I was able to write the first 3 tests without changing how it uses a Task:
test_showsPlaceholderWhileLoading
test_loadsImageFromURL
test_showsLoadedImage
But to test canceling the task, I extracted protocols to create seams:
- Cancellable (slice of Task)
- AbstractTaskFactory with implementers DetachedTaskFactory and TestingTaskFactory
This let me write:
test_secondImageLoadCancelsFirstImageLoad
These 4 microtests run in 22ms.
I went to bed thinking about a new conference talk: "What If?" The goal would be to expand people's thinking about what is possible. Maybe even inspire new toolmakers. Based on a talk by Llewellyn Falco, it would be a coding demo showing my preferred Swift tools:
• AppCode (RIP, just to inspire) showcasing automated refactoring
• TCR (test && commit || revert) for refactoring (impractical in Xcode, easy in AppCode)
• ApprovalTests (the one piece you can use in Xcode, but very few people know about it)
#SwiftLang folks: Would you come to such a talk?
Hey Swift fans, here is our Christmas present 🎅 for you:
🎁 ObjectBox Swift 1.8.0 🎁
https://github.com/objectbox/objectbox-swift/releases/tag/v1.8.0
>> Build with Xcode 14.1 and Swift 5.7.1
>> Enjoy many internal improvements -> full list here https://cpp.objectbox.io/#latest-versions-changelogs
#SwiftLang #iosdeveloper #iosdev
Welcome fellow kids!
#Xcode #SwiftLang #SwiftOnServer #SwiftServer
#xcode #SwiftLang #SwiftOnServer #SwiftServer
Heads up if you are using TCA and mixing ReducerProtocol with old style reducers. Without explicit types, compile times can explode. Our app reducer went from 10s to 100s until we added explicit types with just a single ReducerProtocol 🤯
#SwiftLang
This code has a major bug which is caused by an irritating Swift inconsistency. Can you spot it?
#SwiftLang