Post

Replies

Boosts

Views

Activity

Reply to Dynamic height
Aim To find the size (height) of a view Approach Use the GeometryReader on the .background of the view you want to calculate the size, that way GeometryReader wouldn't tamper the view's dimensions Send the size (height) determined to the parent view using @Binding or Preferences Binding A reference to a value type Preferences You could read a bit about Preferences, it is used to send value to the parent views (opposite of what environment value does) Create a PreferenceKey Set the preference using .preference modifier Detect the value change using onPreferenceChange
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’22
Reply to How to make a view
It might help to watch /read about the basics of SwiftUI, you have model that you can observe, so when the state of the model changes, your views would update, so your view should use the states to determine how the UI should look like.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’22
Reply to Weird UI layout in SwiftUI .swipeActions
Works for me I have a simplified example tried on macOS Ventura which seems to working ok. Please check Check your TableRow code, try to replace with TableRow with Text and see if it works My Code struct Message: Identifiable { var text: String var id: String { text } } struct ContentView: View { let messages = [Message(text: "aaa"), Message(text: "bbb"), Message(text: "ccc")] var body: some View { VStack { List { Section { ForEach(messages) { message in Text(message.text) .swipeActions { Button(role: .destructive) { // data.delete(datum) } label: { Label("Delete", systemImage: "trash") } } } } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’22
Reply to Logger messages not showing in XCode console
@eskimo I am using Logger (OSLog) and I don't want debug messages from frameworks like mentioned below. What should I do to achieve that? When I use CoreData / CloudKit especially NSPersistentCloudKitContainer I do see a lot of debug messages such as the ones below: CoreData: debug: CoreData+CloudKit: -[PFCloudKitOptionsValidator validateOptions:andStoreOptions:error:](36): Validating options: <NSCloudKitMirroringDelegateOptions: 0x600002804090> containerIdentifier:<my bundle id> databaseScope:Private ckAssetThresholdBytes:<null> operationMemoryThresholdBytes:<null> useEncryptedStorage:NO useDeviceToDeviceEncryption:NO automaticallyDownloadFileBackedFutures:NO automaticallyScheduleImportAndExportOperations:YES skipCloudKitSetup:NO preserveLegacyRecordMetadataBehavior:NO useDaemon:YES apsConnectionMachServiceName:<null> containerProvider:<PFCloudKitContainerProvider: 0x600001800260> storeMonitorProvider:<PFCloudKitStoreMonitorProvider: 0x600001800320> metricsClient:<PFCloudKitMetricsClient: 0x600001800390> metadataPurger:<PFCloudKitMetadataPurger: 0x6000018003a0> scheduler:<null> notificationListener:<null> containerOptions:<null> defaultOperationConfiguration:<null> progressProvider:<NSPersistentCloudKitContainer: 0x600000f0d000> test_useLegacySavePolicy:YES archivingUtilities:<PFCloudKitArchivingUtilities: 0x6000018003b0> bypassSchedulerActivityForInitialImport:NO storeOptions: { NSInferMappingModelAutomaticallyOption = 1; NSMigratePersistentStoresAutomaticallyOption = 1; NSPersistentCloudKitContainerOptionsKey = "<NSPersistentCloudKitContainerOptions: 0x60000140ac70>"; NSPersistentHistoryTrackingKey = 1; NSPersistentStoreMirroringOptionsKey = { NSPersistentStoreMirroringDelegateOptionKey = "<NSCloudKitMirroringDelegate: 0x60000230c380>"; }; NSPersistentStoreRemoteChangeNotificationOptionKey = 1; }
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’22
Reply to 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
@DTS Engineer I tried on a clean sample project and I am able to reproduce the fault log 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release I have filed a feedback FB22634797 with the following: Sample project (minimum code) Screen recording Steps to reproduce Note: I have turned on strict concurrency and swift language to 6. I have mentioned everything in the feedback. Questions Is this a bug? If this is a bug, can this fault be ignored (in production app) or what is the recommended approach till the bug gets fixed? Any help on this would be much appreciated!
6d
Reply to Async/let producing error in playground? Xcode 13.0 beta
@eskimo Do we have to file a bug for playgrounds? I am still on macOS BigSur, so can't run it on a command line project as it would require macOS 12 (Beta). I was preparing some tutorials to demonstrate async let so thought playgrounds was ideal as opposed to an iOS project
Replies
Boosts
Views
Activity
Jul ’21
Reply to @SceneStorage not working on macOS
Your code works fine on the following configuration: macOS 12.4 (21F79) Xcode Version 13.4 (13F17a) Checkbox selection is restored on re-run Give it like a few seconds for it to be persisted or tap on a different app for it to save the state.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’22
Reply to Dynamic height
Aim To find the size (height) of a view Approach Use the GeometryReader on the .background of the view you want to calculate the size, that way GeometryReader wouldn't tamper the view's dimensions Send the size (height) determined to the parent view using @Binding or Preferences Binding A reference to a value type Preferences You could read a bit about Preferences, it is used to send value to the parent views (opposite of what environment value does) Create a PreferenceKey Set the preference using .preference modifier Detect the value change using onPreferenceChange
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’22
Reply to How to Active NavigationLink at Change Data in iOS 16
Can you please watch https://developer.apple.com/wwdc22/10054, it goes into great detail step by step about the new navigation APIs
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to How to make a view
It might help to watch /read about the basics of SwiftUI, you have model that you can observe, so when the state of the model changes, your views would update, so your view should use the states to determine how the UI should look like.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Weird UI layout in SwiftUI .swipeActions
Works for me I have a simplified example tried on macOS Ventura which seems to working ok. Please check Check your TableRow code, try to replace with TableRow with Text and see if it works My Code struct Message: Identifiable { var text: String var id: String { text } } struct ContentView: View { let messages = [Message(text: "aaa"), Message(text: "bbb"), Message(text: "ccc")] var body: some View { VStack { List { Section { ForEach(messages) { message in Text(message.text) .swipeActions { Button(role: .destructive) { // data.delete(datum) } label: { Label("Delete", systemImage: "trash") } } } } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to Logger messages not showing in XCode console
@eskimo I am using Logger (OSLog) and I don't want debug messages from frameworks like mentioned below. What should I do to achieve that? When I use CoreData / CloudKit especially NSPersistentCloudKitContainer I do see a lot of debug messages such as the ones below: CoreData: debug: CoreData+CloudKit: -[PFCloudKitOptionsValidator validateOptions:andStoreOptions:error:](36): Validating options: <NSCloudKitMirroringDelegateOptions: 0x600002804090> containerIdentifier:<my bundle id> databaseScope:Private ckAssetThresholdBytes:<null> operationMemoryThresholdBytes:<null> useEncryptedStorage:NO useDeviceToDeviceEncryption:NO automaticallyDownloadFileBackedFutures:NO automaticallyScheduleImportAndExportOperations:YES skipCloudKitSetup:NO preserveLegacyRecordMetadataBehavior:NO useDaemon:YES apsConnectionMachServiceName:<null> containerProvider:<PFCloudKitContainerProvider: 0x600001800260> storeMonitorProvider:<PFCloudKitStoreMonitorProvider: 0x600001800320> metricsClient:<PFCloudKitMetricsClient: 0x600001800390> metadataPurger:<PFCloudKitMetadataPurger: 0x6000018003a0> scheduler:<null> notificationListener:<null> containerOptions:<null> defaultOperationConfiguration:<null> progressProvider:<NSPersistentCloudKitContainer: 0x600000f0d000> test_useLegacySavePolicy:YES archivingUtilities:<PFCloudKitArchivingUtilities: 0x6000018003b0> bypassSchedulerActivityForInitialImport:NO storeOptions: { NSInferMappingModelAutomaticallyOption = 1; NSMigratePersistentStoresAutomaticallyOption = 1; NSPersistentCloudKitContainerOptionsKey = "<NSPersistentCloudKitContainerOptions: 0x60000140ac70>"; NSPersistentHistoryTrackingKey = 1; NSPersistentStoreMirroringOptionsKey = { NSPersistentStoreMirroringDelegateOptionKey = "<NSCloudKitMirroringDelegate: 0x60000230c380>"; }; NSPersistentStoreRemoteChangeNotificationOptionKey = 1; }
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
@DTS Engineer I tried on a clean sample project and I am able to reproduce the fault log 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release I have filed a feedback FB22634797 with the following: Sample project (minimum code) Screen recording Steps to reproduce Note: I have turned on strict concurrency and swift language to 6. I have mentioned everything in the feedback. Questions Is this a bug? If this is a bug, can this fault be ignored (in production app) or what is the recommended approach till the bug gets fixed? Any help on this would be much appreciated!
Replies
Boosts
Views
Activity
6d
Reply to CloudKit Query (and Dashboard) returns only a few records
queryCompletionBlock is deprecated. Use queryResultBlock instead. Also in subsequent CKQueryOperation you create with a cursor, set the resultsLimit. (I think this is optional but if you want to override the default value you could set it)
Replies
Boosts
Views
Activity
3d