Post

Replies

Boosts

Views

Activity

is there a demo app for the "Add configuration and intelligence to your widgets" WWDC session
is there a demo app for the "Add configuration and intelligence to your widgets" WWDC2020 session? Xcode doesn't autogenerate any of the code that the demo says it will and parts of the code show in the video is cut off on the screen so I can't see what the code is. keen to get the app so I can manually copy it in. also the written instructions at https://developer.apple.com/documentation/widgetkit/making-a-configurable-widget seem to miss parts out as Xcode doesn't generate the code that the instructions say it will. a demo app for that will also be helpful
5
0
1.5k
Sep ’20
Xcode iOS15 beta 2 .tag in ForEach doesn't compile
in Xcode iOs15 beta 2 the .tag modifier in a ForEach statement gives the following compile error "The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions" the error shows up on the .navigationBarTitle line but its due to the .tag line works fine on all previous releases. anyone know how to fix? code example below func content() -> some View {         let rentFrequencies = RentFrequency.allCases         return List {             ForEach(rentFrequencies, id: \.self) { rentFrequency in                 if rentFrequency != RentFrequency.NoFrequency {                     HStack() { Text(rentFrequency.name).tag(rentFrequency.id) // Including this tag makes it not compile                         if rentFrequency == type {                             Spacer()                             Image(systemName: "checkmark") .foregroundColor(.accentColor)                         }                     }                     .onTapGestureForced(perform: { self.type = rentFrequency })                     .frame(width: nil, height: 32.0)                 }             }         } .listStyle(InsetGroupedListStyle())         .navigationBarTitle("Rent Frequency")     }
0
0
947
Jun ’21
Charts: customising chartYAxis values
anyone figured out how to customise the Y axis values? id like to be able to process the. axis values and. then display them in the. format id like. eg. "1000" I'd like to display as "1k" the furthest Ive been able to get is to get the axis to display a static text as the number ie "Y" in the code below. but I haven't been able to access the value. in the code below 'value' seems to be an AxisValue which stores the value but I can't seem to access it in a format I can process. .chartYAxis {                 AxisMarks() { value in                     AxisGridLine()                     AxisTick()                     AxisValueLabel {                     Text("Y")                     }                 }             } id like to be able to do something like this: .chartYAxis {                 AxisMarks() { value in                     AxisGridLine()                     AxisTick()                     AxisValueLabel {                         if value > 1000000000000.0 {                             Text("\(value / 1000000000000.0)t")                         } else if value > 1000000000.0 {                             Text("\(value / 1000000000.0)b")                         } else if value > 1000000.0 {                             Text("\(value / 1000000.0)m")                         } else if value > 1000.0 {                             Text("\(value / 1000.0)k")                         }                     }                 }             }
5
2
5.1k
Jun ’22
NavigationStack with NavigationLink - back button only works correctly one deep
So I have a navigationStack which has a NavigationLink that navigates to the next view. That view then has its own NavigationLink that navigate to a 3rd view. if the user clicks on the back button on the 3rd view (View3) to return to the previous view (View 2), it goes right back to the starting view (View 1). an one else have this issue or know how to fix? ios16b1 example below: View 1: NavigationStack {                 View2()                     .navigationTitle("View 2")             } View 2: List {        VStack (alignment: .leading) {                     NavigationLink("View 3", destination: {                         View3()                     }) } }
3
2
1.3k
Jun ’22
Loading large number of records into the CloudKit public database
Anyone know how to load a large number of records into the CloudKit public database? I need to load 1.2million records (about 150Mb) into the public database. no binary data. basically just a bunch of exchange rates that I need to have available to all my users. I've been trying for months. have tried: loading into core data on a device or simulator individually or in batches ranging from 400 records to 2500 (more than that exceeds batch size limits). it will start to sync and then stop. can often get it to restart by restarting device or similator but will eventually corrupt the database in iCloud requiring a reset of the environment. generally can get the load to go for a few days and load maybe 500k records before it breaks. to do that have to put delays up to a minute between batches loaded into core data. have tried doing it using the CloudKit.js framework and loading from a server. this works for a small number of records. but limits are really small doing it through that interface. after a while it locks you out. don't get anywhere near the number of records I need to load. I'm stuck. has anyone found a way? same issue on all versions of iOS - 14, 15, 16b1
2
1
1.4k
Jun ’22
AppIntents: pauses in siri's speech and hiding dialog text
Is it possible to put a pause in Siri's responses to an AppIntent? in the code below id like Siri to pause a bit longer than she does between sentence one and sentence two. i've tried using "..." and multiple "." similar to what she does when she's responding to "how is the market" if you ask a HomePod - she pauses a bit longer between her comments on each market, a bit more than an end of sentence - more like the pause between each point when you are going through a list of bullet points - which is really what i'm using this for. Also is it possible to hide all or part of of the dialog text displayed? so she says it but doesn't show it. I've got a view which shows a better formatted representation of what she says than the text itself. struct TestAppIntent: AppIntent {     static var title: LocalizedStringResource = "A question?"     static var openAppWhenRun: Bool = false     @MainActor     func perform() async throws -> some IntentResult {         return .result(             dialog: "sentence one. sentence two", view: someView()         )     } }
1
2
1.2k
Jul ’22
A navigationDestination for <App.Entity> was declared earlier on the stack. Only the destination declared closest to the root view of the stack will be used.
anyone been able to get rid of this error? A navigationDestination for <App.Entity> was declared earlier on the stack. Only the destination declared closest to the root view of the stack will be used. Seems to happen when im using a NavigationLink(value:) and a NavigationLink(destination:) in the same class. I'd think it would make sense to be able to use both methods? ios16 b5
1
0
3.2k
Aug ’22
Capture of 'notification' with non-sendable type 'NSNotification' in a `@Sendable` closure
Get this warning compiling with ios16 b5. anyone know what this is? no warning on ios15. Capture of 'notification' with non-sendable type 'NSNotification' in a @Sendable closure The line it shows on is: let myObject = notification.object as! MyObject I also noticed that NSNotificationCenter notifications in general seem to have broken in iOS16 betas. Are they getting removed?
0
1
1.3k
Aug ’22
Calling actor method from another actor
so ive got an actor that im using to control concurrent access to some shared data. I have a second actor that controls concurrent access to another set of different shared data actor DataManager { static let shared = DataManager() func fetchData() async { modifySomeData() let blah = await SecondDataManager.shared.fetchDifferentData() } } actor SecondDataManager { static let shared = SecondDataManager() func fetchDifferentData() -&gt; [SomeData] { return stuff } } im finding that because of the await in the fetchData() method, the actor no longer ensures that the DataManager.fetchData() function can only be executed one at a time thus corrupting my shared data because fetchData() needs to be async due to the call on the second actor method. Any way to ensure DataManager.fetchData() can only be executed one at a time? normally id use a DispatchQueue or locks. but it seems these can't be combined with actors.
1
0
2.5k
Sep ’22
error: CoreData+CloudKit: Never successfully initialized and cannot execute request - incomprehensible archive
anyone getting the following error with CloudKit+CoreData on iOS16 RC? delete/resintall app, delete user CloudKit data and reset of environment don't fix. [error] error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _requestAbortedNotInitialized:](2044): <NSCloudKitMirroringDelegate: 0x2816f89a0> - Never successfully initialized and cannot execute request '<NSCloudKitMirroringImportRequest: 0x283abfa00> 41E6B8D6-08C7-4C73-A718-71291DFA67E4' due to error: Error Domain=NSCocoaErrorDomain Code=4864 "*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: incomprehensible archive (0x53, 0x6f, 0x6d, 0x65, 0x20, 0x65, 0x78, 0x61)" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: incomprehensible archive (0x53, 0x6f, 0x6d, 0x65, 0x20, 0x65, 0x78, 0x61)}
4
0
1.5k
Sep ’22
SwiftUI NavigationLink freezing when tapped
Any one getting any issues with NavigaitonLink to seemingly innocuous views freezing when tapped on? 1 CPU at 100% memory steadily increasing until app gets killed by the system. Will freeze if any NavigationLink on the view is tapped if certain views are linked to using NavigaitonLink. I note some people have been getting similar freezes if they use @AppStorage, but I'm not using @AppStorage. I do use CoreData tho. tho I have some views that use core data that don't freeze. https://developer.apple.com/forums/thread/708592?page=1#736374022 has anyone experienced similar issues? or know the cause. it doesn't seem to be any of my code because if I pause the debugger it stops on system code.
13
2
7.9k
Nov ’22
Usage of CKQueryOperation.recordMatchedBlock and .queryResultBlock
Anyone know the correct usage for CKQueryOperation.recordMatchedBlock and .queryResultBlock? Xcode is telling me to use them as the old .recordFetchedBlock and .queryCompletionBlock are deprecated, but there isn't any documentation to say how they should be used. ChatGPT, Bard etc aren't able to provide a correct answer either: specifically, I need to convert the following to use those methods: operation.recordFetchedBlock = { record in // Convert CKRecord to Core Data object and save to Core Data self.saveToCoreData(record: record) } operation.queryCompletionBlock = { (cursor, error) in // Handle potential errors if let error = error { print("Error syncing first of month records: \(error)") } if let cursor = cursor { // There are more records to fetch for this category, continue fetching self.continueSyncing(cursor: cursor, completion: completion) } else { // Done syncing this category, move to the next sync task completion() } }
1
0
709
Aug ’23
new swift concurrency model with core data willSave()
anyone know how to use the new swift concurrency model (ie. await context.perform and context.perform) core data willSave()? for example. how would I ensure this is thread safe? changing self.managedObjectContext!.performAndWait to await self.managedObjectContext!.perform means I have to change willSave() to async which then means it never gets called because its not overriding the correct method anymore. override public func willSave() { self.managedObjectContext!.performAndWait { if self.modifiedDate == nil || Date().timeIntervalSince(self.modifiedDate!) >= 1 { self.modifiedDate = Date() } } super.willSave() }
0
0
676
Oct ’23