Posts

Post marked as solved
3 Replies
Thank you! I spent so much time trying to figure it out what's the problem! I'm exactly in the same case trying to represent a dictionary that I mapped to a tuple[(Category: [Item])]it worked great but I really needed to sort it like that for instance:private var searchCategories: [(Category, [Item])] { viewModel.searchResults .map { $0 } .sorted(by: \.key.rawValue) // You really need that to avoid crashes! }And my viewsprivate var searchList: some View { List { ForEach(searchCategories, id: \.0, content: searchSection) }.modifier(DismissingKeyboardOnSwipe()) } private func searchSection(category: Category, items: [Item]) -> some View { Section(header: header(category: category)) { ForEach(items, content: searchItemRow) } } private func searchItemRow(item: Item) -> some View { NavigationLink(destination: ItemDetailView(item: item)) { ItemRowView(item: item) } }
Post marked as solved
27 Replies
I answer to my own comment. It worked yes, but my Unit Tests was broken because I used the same library (SnapshotTesting) for both my main Project and one of my library, so I still have double dependencies... even with .dynamic...I found a workaround by adding an internal Framework who's dealing with SPM libraries. You can find a step by step here: https://github.com/renaudjenny/Swift-Package-Manager-Static-Dynamic-Xcode-Bug
Post marked as solved
27 Replies
You can also create an internal library that merge all your static SPM package. It's a nicer workaround IMO.Step by step explained here: https://github.com/renaudjenny/Swift-Package-Manager-Static-Dynamic-Xcode-Bug
Post marked as solved
27 Replies
Thanks for the help, I used thetype: .dynamictips, and it works, thankfully because the two libraries I used was mine, so it's ok. But I think it's not a solution.If you don't precise a type, Xcode should be smart enough to guess if it has to use either a dynamic or a static library, right? So why it's mendatory to explicit that in the package.swift of the library itself.I would rather like to have an option in Xcode to use the library as dynamic rather than putting that in the library definition 😟