Post

Replies

Boosts

Views

Activity

Reply to How to consume a dynamic Xcode framework?
Hi, thanks for mentioning the .exp file approach. This works well with the scenario I explained above (dynamic framework depending on static libs). However, when I tried this with a slightly different project configuration, I faced linker errors. I replaced the static libs with dynamic libs. So, now I have a dynamic framework with 3 target dependencies, each being a dynamic library. This project builds and runs fine when tested on the iOS simulator. But according to our other discussion here, when I test this on a real iPhone, it builds fine but fails at runtime with a linker error: 0_abort_with_payload and Xcode shows the following assembly instructions specifying the error Thread 1: signal SIGABRT - dyld`: 0x1aa0a15f8 <+0>: mov x16, #0x209 0x1aa0a15fc <+4>: svc #0x80 -> 0x1aa0a1600 <+8>: b.lo 0x1aa0a1620 ; <+40> 0x1aa0a1604 <+12>: pacibsp 0x1aa0a1608 <+16>: stp x29, x30, [sp, #-0x10]! 0x1aa0a160c <+20>: mov x29, sp 0x1aa0a1610 <+24>: bl 0x1aa040064 ; cerror_nocancel 0x1aa0a1614 <+28>: mov sp, x29 0x1aa0a1618 <+32>: ldp x29, x30, [sp], #0x10 0x1aa0a161c <+36>: retab 0x1aa0a1620 <+40>: ret Please let me know what am I doing wrong here. I noticed that the dynamic libs are not present in the .app bundle located in the product build output directory. I added a Copy Files build phase to copy these libs to the .app bundle but still face the same error.
Oct ’25
Reply to How to consume a dynamic Xcode framework?
Thanks for the flag. I used the nm -m framework_binary command to check what symbols are currently being exposed by the framework. Below is my framework's header file: #import <Foundation/Foundation.h> //! Project version number for TWFramework. FOUNDATION_EXPORT double TWFrameworkVersionNumber; //! Project version string for TWFramework. FOUNDATION_EXPORT const unsigned char TWFrameworkVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <TWFramework/PublicHeader.h> // how to include a generated swift header here? the output of nm -m framework_binary is 0000000000003ff8 (__TEXT,__const) external _TWFrameworkVersionNumber 0000000000003fc8 (__TEXT,__const) external _TWFrameworkVersionString My static libraries consist of swift files, I am not sure how to include them to the main header file. As per my understanding, the swift methods are automatically exposed as long as they are marked as public. So, how do I tell the framework's header file to export the publicly defined swift methods from the static libraries present in the framework's dependencies? PS: I have a single Xcode project, and each library and framework exists as a separate build target in the same project.
Sep ’25
Reply to What exactly an Xcode framework does?
Hi, I've uploaded the test project on github: https://github.com/Raunit-TW/xcode-framework-poc Adding more context to the problem, it was first discussed here: https://developer.apple.com/forums/thread/751522. To summarize, we have an application with a bunch of extensions, all of them dependent on some common C++ source files. Building each target individually leads to a bloated app bundle and final binary, since the contents are copied to each binary. As per our understanding, frameworks can solve this issue of increased binary size by packaging the common C++ files separately such that they can be shared among the extensions.
Sep ’25
Reply to Passing string between Swift and C++
As you mentioned, we too see 'best' as a 'reliable and safe' approach. Yes, we're mainly concerned with bridging between C strings and Swift Strings. The implicit conversion provided in Approach 2 uses std::string and while we can obtain the C string from this std::string, we're not supposed to use the std data structures - so maybe approach 3 or 1 is the way to go - or something different that is not known to us yet. What would you recommend?
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’25
Reply to How to capture the currently pressed key when a TextField is in focus?
Thanks for the quick responses! @Claude31 's solution covers almost all my use cases except for one. I am unable to detect modifier-only keypresses with the above approach. TextField ("Enter text...", text: $txt) .onKeyPress(action: {keyPress in print ("key: \(keyPress.key), modifier: \(keyPress.modifiers)"); return .ignored; }) For eg, nothing gets printed when I press only the Alt key. I ask this since my application has to allow the user to experience additional functionality on press of special keys - like pressing the Alt key may trigger a particular menu on a particular screen. How can I detect such keypresses, or is it not possible by design? The intent is to be able to implement custom functionality corresponding to an extensive set of hotkey combinations and modifier-only keys. Please correct me if I'm approaching the problem in the wrong direction.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’25
Reply to Alternatives to exports file for using Xcode frameworks in iOS
Yes, I'm looking for ways to achieve the same behavior without using an .exp file at all. Using the exports file is neither an issue nor any bug (apologies for the wrong terminology), I'm just looking for any other ways that do not use an exports file. Thanks.
Replies
Boosts
Views
Activity
Dec ’25
Reply to How to consume a dynamic Xcode framework?
Hi, thanks for mentioning the .exp file approach. This works well with the scenario I explained above (dynamic framework depending on static libs). However, when I tried this with a slightly different project configuration, I faced linker errors. I replaced the static libs with dynamic libs. So, now I have a dynamic framework with 3 target dependencies, each being a dynamic library. This project builds and runs fine when tested on the iOS simulator. But according to our other discussion here, when I test this on a real iPhone, it builds fine but fails at runtime with a linker error: 0_abort_with_payload and Xcode shows the following assembly instructions specifying the error Thread 1: signal SIGABRT - dyld`: 0x1aa0a15f8 <+0>: mov x16, #0x209 0x1aa0a15fc <+4>: svc #0x80 -> 0x1aa0a1600 <+8>: b.lo 0x1aa0a1620 ; <+40> 0x1aa0a1604 <+12>: pacibsp 0x1aa0a1608 <+16>: stp x29, x30, [sp, #-0x10]! 0x1aa0a160c <+20>: mov x29, sp 0x1aa0a1610 <+24>: bl 0x1aa040064 ; cerror_nocancel 0x1aa0a1614 <+28>: mov sp, x29 0x1aa0a1618 <+32>: ldp x29, x30, [sp], #0x10 0x1aa0a161c <+36>: retab 0x1aa0a1620 <+40>: ret Please let me know what am I doing wrong here. I noticed that the dynamic libs are not present in the .app bundle located in the product build output directory. I added a Copy Files build phase to copy these libs to the .app bundle but still face the same error.
Replies
Boosts
Views
Activity
Oct ’25
Reply to Embed/Do Not Embed & Mach-O type
Hi. I'm testing this in the simulator.
Replies
Boosts
Views
Activity
Oct ’25
Reply to How to consume a dynamic Xcode framework?
Thanks for the flag. I used the nm -m framework_binary command to check what symbols are currently being exposed by the framework. Below is my framework's header file: #import <Foundation/Foundation.h> //! Project version number for TWFramework. FOUNDATION_EXPORT double TWFrameworkVersionNumber; //! Project version string for TWFramework. FOUNDATION_EXPORT const unsigned char TWFrameworkVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <TWFramework/PublicHeader.h> // how to include a generated swift header here? the output of nm -m framework_binary is 0000000000003ff8 (__TEXT,__const) external _TWFrameworkVersionNumber 0000000000003fc8 (__TEXT,__const) external _TWFrameworkVersionString My static libraries consist of swift files, I am not sure how to include them to the main header file. As per my understanding, the swift methods are automatically exposed as long as they are marked as public. So, how do I tell the framework's header file to export the publicly defined swift methods from the static libraries present in the framework's dependencies? PS: I have a single Xcode project, and each library and framework exists as a separate build target in the same project.
Replies
Boosts
Views
Activity
Sep ’25
Reply to What exactly an Xcode framework does?
Hi, I've uploaded the test project on github: https://github.com/Raunit-TW/xcode-framework-poc Adding more context to the problem, it was first discussed here: https://developer.apple.com/forums/thread/751522. To summarize, we have an application with a bunch of extensions, all of them dependent on some common C++ source files. Building each target individually leads to a bloated app bundle and final binary, since the contents are copied to each binary. As per our understanding, frameworks can solve this issue of increased binary size by packaging the common C++ files separately such that they can be shared among the extensions.
Replies
Boosts
Views
Activity
Sep ’25
Reply to How to speed-up initial UI rendering faster in AppKit?
I’ve used NSTextField as an example, but in reality, there will be various types of UI elements, such as buttons, dropdowns, tables, and more. All these elements must be visible on the screen all at once.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to Passing string between Swift and C++
As you mentioned, we too see 'best' as a 'reliable and safe' approach. Yes, we're mainly concerned with bridging between C strings and Swift Strings. The implicit conversion provided in Approach 2 uses std::string and while we can obtain the C string from this std::string, we're not supposed to use the std data structures - so maybe approach 3 or 1 is the way to go - or something different that is not known to us yet. What would you recommend?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’25
Reply to How to capture the currently pressed key when a TextField is in focus?
Thanks for the quick responses! @Claude31 's solution covers almost all my use cases except for one. I am unable to detect modifier-only keypresses with the above approach. TextField ("Enter text...", text: $txt) .onKeyPress(action: {keyPress in print ("key: \(keyPress.key), modifier: \(keyPress.modifiers)"); return .ignored; }) For eg, nothing gets printed when I press only the Alt key. I ask this since my application has to allow the user to experience additional functionality on press of special keys - like pressing the Alt key may trigger a particular menu on a particular screen. How can I detect such keypresses, or is it not possible by design? The intent is to be able to implement custom functionality corresponding to an extensive set of hotkey combinations and modifier-only keys. Please correct me if I'm approaching the problem in the wrong direction.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Apr ’25
Reply to How to programmatically set cursor position of a text field in SwiftUI
Thanks for pointing this out. I went through the docs and tried out a demo and this indeed solves my issue. I can see that this works for iOS 18+. My target is iOS 14+, is there any equivalent for this initializer that works for the previous versions as well?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Apr ’25