Embedded Swift for iOS 6 and Armv7

Embedded Swift running on iOS 6, built with Xcode 27 and Swift 6.4. Compiled for bare metal Armv7.

10 Likes

Just curious how this project is able to call Objective-C. That is something I am very curious about.

Embedded Swift can make C calls, and [foo bar] is three C calls in a trenchcoat. You wouldn't get Objective-C interop by default, but it's pretty straightforward to call objc_msgSend() manually.

2 Likes

Oh, I have an iPad 1st gen hanging around. I am intrigued :upside_down_face:

Ah darn - that's iOS 5 :zany_face:

I'm not aware of any reason that you couldn't get Embedded Swift working on iOS 5!

1 Like

Ha! you forgot about "incompetence"! :zany_face:

Isn't that what Claude's for? :wink:

2 Likes

Yeah, that's a good technique that I used in a bridge a while back, but I saw actual .m files with ObjC classes defined. https://github.com/colemancda/Swift-iOS6/blob/main/SwiftUI/Sources/CSwiftUIBackend/Backend.m.

With subclassing

@interface SUIActionTarget : NSObject
@property (nonatomic) SUICallback action;
@property (nonatomic) void *context;
@end

And I wan't sure if this was actually a part of the build, or if this could only work up to the point of needing to pass the ObjC class into Swift.

You could probably make interop fairly ergonomic with dynamicallyCallable wrapping the objc runtime api

I have another version for iOS 9, tested in iPhone 4s. Main difference is the use of UIStackView and view resizing, vs iOS 6 SwiftUI is just explicit frames for UIViews. Also CoreBluetooth is actually usable.

That’s a good idea for v2. For this POC I just wanted something quick and dirty.

1 Like