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
May ’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") } } } } } } } }
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.
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; }
Nov ’22