Post

Replies

Boosts

Views

Activity

Swift Package-generated Xcode project doesn't include resources
Hello! We have some resources included as part of our test target like so:         .testTarget(             name: "MyProjectTests",             dependencies: ["MyProject"],             resources: 							[.process("Assets/Test_5s.mov")]) However, when running the following command: swift package generate-xcodeproj the generated package does not include the assets. Additionally the code to access the resources won't compile because there is no auto-generated file to provide the 'module' extension for 'Bundle'. Bundle.module.url(forResource: "Test_5s", withExtension: "mov") results in a "Type 'Bundle' has no member 'module'" compilation error. Is this a known issue, or am I approaching this incorrectly if I want to have a project for the package? Currently using Xcode 12 beta 2
13
0
6.9k
Jul ’20
Combine Publisher + SwiftUI = MemoryLeak
We are seeing a memory leak when using a combine TimePublisher (as in the code below) to trigger a fade out of a view. This is pretty simplified, but I'm struggling to see where we are going wrong. Removing the onAppear block or changing it to set showRedView to false directly removes the leak. It seems directly tied to our use of the publisher. class ContentViewModel: ObservableObject {     @Published var showRedView = true     var subscriptions: Set<AnyCancellable> = []         func fadeRedView() {         Timer.publish(every: 5.0, on: .main, in: .default)             .autoconnect()             .prefix(1)             .sink { [weak self] _ in                 withAnimation {                     self?.showRedView = false                 }             }             .store(in: &subscriptions)     } } struct ContentView: View {     @ObservedObject var viewModel = ContentViewModel()     var body: some View {         ZStack {             if viewModel.showRedView {                 Color.red                     .transition(.opacity)             }             Text("Hello, world!")                 .padding()         }         .onAppear {             self.viewModel.fadeRedView()         }     } } We are seeing this leak in both Xcode 11 and Xcode 12, so doesn't seem related to the current beta. Any help is appreciated as always, thanks!
2
0
2.2k
Aug ’20