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
979
Aug ’23
New sideBar + tabBar bug.
Hello, I was implementing the new sideBar when I encounter a very weird behaviour. I have a UISplitView which contain a property: var secondaryViewControllers : [UIViewController] This splitView is composed like this: a sideBarVC for the sideBar a secondary VC a classic tabBarVC for the compact mode When we tap an item in the sideBar it assign a new viewController to the .secondary of the splitView, it also change the selected index of the TabBar to keep in sync. The reverse is true too, when we select an item of the tabBarVC when in .compact mode the .secondary and the sideBar are updated. So with this we can can go from .compact mode to sidebar mode and getting the same VC selected. So I assign the array "secondaryViewControllers" to the tabBarVC and the same array is used the displaying the VC in the .secondary section. That's what I want the selected section of the app keep synced. In my iPhone app I can pass from portrait to landcape and the correct section will be selected. But to only the section selected should be the same, the vc itself should be the same when passing in landscape mode. Loosing the state and progress would be strange. That's why it's the same instances of the vc used for .secondary and .compact tabBarVC. Here is where it bug, when a VC is used in the .secondary of my splitVC it's removed from my tabBarVC. Example: At launch I select the first section by default. Let's say I open as .compact. Instead of having 3 tabBar item I will have 3 because the first one was removing due to the fact it's used in .seconday. If I go to landscape I can use all of them without any problem but each time I'll open a vc from the sideBar (so set the .secondary in the splitVC) this vc will be removed from the tabBar. Is that normal ??? I could workaround by not using the same instances for .compact but it would be weird to not have the same stade in landscape and in portrait. Passsing to landscape: a state, back to portrait: the state before I passed to landscape.
0
0
609
Sep ’20
No widget placeholder with core data object
Hello, My widgets use core data to display informations, so for placeholder I create an example object that's going be used only for that placeholder. I only get a blank, why ? If I set the task to nil the view appear correctly, because in that case my view display only a Text. I looks like I can't use a NSManagedObject subclass for constructing my view func placeholder(with: Context) -> TaskEntry {         let tmpContext = NSManagedObjectContext(concurrencyType: .mainQueueConcurrencyType)         let task = Task(context: tmpContext)                  let subject = Subject(context: tmpContext)         subject.title = "Oriented object Programming"         task.subject = subject                  task.title = "learning abstract classes"                  task.deadline = Calendar.current.date(byAdding: .day, value: 1, to: Date())         return TaskEntry(date: Date(), task: nil)     }
2
0
1k
Jul ’20
new widgets doesn't appear in widget gallery
Hello, I have added a widget extension in my iOS app but when I run the iOS app, it doesn't appear in widget gallery. So I tried to run the widget extension directly and most of time I get this error : SendProcessControlEvent:toPid: encountered an error: Error Domain=com.apple.dt.deviceprocesscontrolservice Code=8 "Failed to show Widget 'com.Ce-dricLoneux.School-Companion.WidgetsSchoolCompanion' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (com.Ce-dricLoneux.School-Companion.WidgetsSchoolCompanion)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (com.Ce-dricLoneux.School-Companion.WidgetsSchoolCompanion)}." UserInfo={NSLocalizedDescription=Failed to show Widget 'com.Ce-dricLoneux.School-Companion.WidgetsSchoolCompanion' error: Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (com.Ce-dricLoneux.School-Companion.WidgetsSchoolCompanion)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (com.Ce-dricLoneux.School-Companion.WidgetsSchoolCompanion)}., NSUnderlyingError=0x10ffccbb0 {Error Domain=SBAvocadoDebuggingControllerErrorDomain Code=1 "Failed to get descriptors for extensionBundleID (com.Ce-dricLoneux.School-Companion.WidgetsSchoolCompanion)" UserInfo={NSLocalizedDescription=Failed to get descriptors for extensionBundleID (com.Ce-dricLoneux.School-Companion.WidgetsSchoolCompanion)}}} Domain: DTXMessage Code: 1 Then I can close this message and the widget is in app gallery. In the settings of the iOS apps, section : Framework, libraries and embedded content : The widget .appex is there so I don't understand why the widget extension isn't packed with iOS app.
5
1
2.6k
Jul ’20
iCloud keyValue in new widgets and timeline time
Hello, I have two questions about new widgets : First I can't access my iCloud keyValues from new widgets, is it normal ? I configured correctly app capabilities. That's a big problem we have on watchOS too and I don't understand why it's still not available. Second, in WWDC apple say a timeline is typically 24hours. Should we make 24hours if possible ? My timeline is for a week because it's a schedule but I could do a shorter and refresh each 24 hours without problems.
2
0
905
Jul ’20
new UIDatePicker as inputView
With iOS 13 and earlier we could use UIDatePicker as inputView but what now ? I tried with ios14 and when the textfield is tapped nothing append. var timePicker = UIDatePicker() self.timePicker.preferredDatePickerStyle = UIDatePickerStyle.wheels &#9;&#9;&#9;&#9;self.timePicker.datePickerMode = UIDatePicker.Mode.time &#9;&#9;&#9;&#9;self.timePicker.minuteInterval = 5 &#9;&#9;&#9;&#9;self.startTimeTxtField.inputView = self.timePicker Is it normal ?
5
0
8.6k
Jul ’20
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
12k
Jun ’20