Post

Replies

Boosts

Views

Activity

SwiftData fetch request publisher returns only one value
I am using repository pattern in my app so the repository has such a function: func getAll() throws -> some Publisher<[CryptoPrice], Never> { let descriptor = FetchDescriptor<CryptoPriceDbEntity>() let testPublisher = try context.fetch(descriptor) .publisher .print() .map { dbEntity in CryptoPriceMapper.mapFromDbEntity(dbEntity) } .collect() .print() .eraseToAnyPublisher() //FIXME: this publisher send one value and then close. Is it normal behaviour of swift Data return testPublisher } and the view model subscribe to this. I was expecting the view model to receive the new query result whenever it the database changes as a constant stream. But I was surprised to see the publisher send some data once and then it close immediately. Is it normal behaviour of SwiftData or is there a big in this code ?
1
0
1.2k
Oct ’23
No .entitlements file generated with widget extension
Hello, my app use. iCloud with core data so for all my target. was generated automatically a .entitlements file. This file contains for exemple : my app group identifier. When I added the new widget. extension many filles were created but no .entitlements file. So here when I try to access to the app group the app crash. Is the fact .entitlements isn't generated with widget extension a bug ?
5
0
13k
May ’21