blog
blog copied to clipboard
🍁 What you don't know is what you haven't learned
When user taps on push notification, depending on app state [SceneDelegate](https://developer.apple.com/documentation/uikit/uiscenedelegate/3197914-scene) Checking `UIScene.ConnectionOptions.notificationResponse?.notification.request.content.userInfo` in `scene(_:willConnectTo:options:)` - app terminated: sometimes nil - app in background: notification info [UNUserNotificationCenter](https://developer.apple.com/documentation/usernotifications/unusernotificationcenterdelegate/1649501-usernotificationcenter) Checking `UNNotificationResponse.notification.request.content.userInfo` in...
```swift datePicker.setValue(UIColor.green, forKey: "textColor") datePicker.setValue(false, forKey: "highlightsToday") ``` In iOS 14 ```swift if #available(iOS 14.0, *) { datePicker.preferredDatePickerStyle = .wheels datePicker.tintColor = UIColor.green } ``` ## Inspect attributes - https://developer.apple.com/documentation/objectivec/nsobject/1415656-attributekeys
## Apple app site association https://com.example/.well-known/apple-app-site-association [Supporting Associated Domains](https://developer.apple.com/documentation/xcode/supporting-associated-domains) New format from iOS 13 Can also remove `components` section if we match all URLs ```swift { "applinks": { "details": [...
From iOS 14, we can do [Identity Pinning: How to configure server certificates for your app](https://developer.apple.com/news/?id=g9ejcf8y) right from `Info.plist` ```xml NSAppTransportSecurity NSPinnedDomains awesome.apps.example.com NSIncludesSubdomains NSPinnedCAIdentities SPKI-SHA256-BASE64 12312312312xasdas123asdasdasdasdsad ``` There are...
Listen to `didActivateApplicationNotification` and check that it is not our app ```swift NSWorkspace.shared.notificationCenter .publisher(for: NSWorkspace.didActivateApplicationNotification) .sink(receiveValue: { [weak self] note in guard let app = note.userInfo?[NSWorkspace.applicationUserInfoKey] as? NSRunningApplication, app.bundleIdentifier !=...
Change element position using either `offset` or `position`, and use `DragGesture` Use `GestureState` to store the updating `startDragLocation` to keep the start location when drag begins, so we can add...
Enable `Read/Write` for `User Selected File` under `Sandbox` to avoid bridge absent error ```swift func showSave( name: String, window: NSWindow ) async -> URL? { let panel = NSSavePanel() panel.directoryURL...
Use [NSTitlebarAccessoryViewController](https://developer.apple.com/documentation/appkit/nstitlebaraccessoryviewcontroller) ```swift var titleBarAccessoryVC: NSTitlebarAccessoryViewController { let vc = NSTitlebarAccessoryViewController() let view = HStack { Spacer() Button { } label: { Text("Save") } .buttonStyle(.borderedProminent) .controlSize(.large) } .padding(.horizontal) vc.view =...
Use https://github.com/biati-digital/glightbox Configure css. Specify `class='glightbox` for html elements ``` ``` Install package ``` npm install glightbox import GLightbox from 'glightbox' ``` ```js const lbElements = features.map((feature) => { return...
During continuous events like dragging or TextField typing, and we have a Picker onscreen with large data set, it will slow down main thread. One option is to explicitly conform...