Post

Replies

Boosts

Views

Activity

Xcode not copying frameworks Swift package with binary target if only included from app extension
I have a Swift Package that includes XCFrameworks which are exported as binary targets. If I include any of the product in Frameworks and Libraries section of a notification service extension target, build succeeds while the extension crashes with dynamic linker error: Library not loaded: @rpath/MoEngageRichNotification.framework/MoEngageRichNotification My workaround is to include the same product in app target's Frameworks and Libraries section and add @executable_path/../../Frameworks to LD_RUNPATH_SEARCH_PATHS settings for extension target. Is this a known limitation of XCode when using SPM?
1
0
205
Oct ’24
Alternative option to initial onChange callback for EmptyView
I am exploring on managing state in SwiftUI app with purpose built Views due to the advantages for managing dependency with Environment. This is the minimal example I came up with: @MainActor struct AsyncStateModifier<T: Equatable>: View { let input: T let action: (T) async -> Void @Environment var queue: AsyncActionQueue var body: some View { return EmptyView() .onChange(of: input, initial: true) { old, new in queue.process(action: action, with: input) } } } The drawback of this approach is initial: true allows the onChange callback to fire when view appears and since EmptyView doesn't appear the action is never executed initially. When replacing EmptyView with Rectangle().hidden() this can be achieved, but I wanted to avoid having any impact on view hierarchy and EmptyView is suitable for that. Is there any alternative approach to make something like this possible?
1
0
500
May ’24