I am using #canImport(JournalingSuggestions), but something is going wrong and my app is attempting to import the framework on iPad, and crashing on launch. How can I ensure that it's properly filtered out from everything except iPhone?
import SwiftUI
#if canImport(JournalingSuggestions)
import JournalingSuggestions
#endif
struct JournalingSuggestionsView: View {
var body: some View {
#if canImport(JournalingSuggestions)
JournalingSuggestionsPicker {
Text("Open Journaling Suggestions")
} onCompletion: { suggestion in
print(suggestion)
}
#else
Text("Journaling suggestions not available on this platform.")
#endif
}
}
Error:
dyld[8689]: Library not loaded: /System/Library/Frameworks/JournalingSuggestions.framework/JournalingSuggestions
Referenced from: <A656E6BC-4883-3245-BE71-3F84C2F41119> /private/var/containers/Bundle/Application/C6C11F57-AFAA-442A-B726-7AADDDB50D79/Catalog.app/Catalog
Reason: tried: '/System/Library/Frameworks/JournalingSuggestions.framework/JournalingSuggestions' (no such file), '/private/preboot/Cryptexes/OS/System/Library/Frameworks/JournalingSuggestions.framework/JournalingSuggestions' (no such file), '/System/Library/Frameworks/JournalingSuggestions.framework/JournalingSuggestions' (no such file, not in dyld cache)
System info:
Xcode 15.2
iPadOS 17.3.1