So I have an NSTableView with automatic row heights whose cells contain a self-sizing NSTextField. The row height adjusts after I finish typing in NSTextField (press enter), but not during, and I need it to adjust during typing as well.
Here's the code for the self-sizing NSTextField:
override var intrinsicContentSize: NSSize {
		// Guard the cell exists and wraps
		guard let cell = self.cell, cell.wraps else {return super.intrinsicContentSize}
		// Use intrinsic width to jive with autolayout
		let width = super.intrinsicContentSize.width
		// Set the frame height to a reasonable number
		self.frame.size.height = 750.0
		// Calcuate height
		let height = cell.cellSize(forBounds: self.frame).height
		return NSMakeSize(width, height);
}
override func textDidChange(_ notification: Notification) {
		super.textDidChange(notification)
		super.invalidateIntrinsicContentSize()
}
The only customization for NSTableView is this line:
tableView.usesAutomaticRowHeights = true
Thanks in advance!
Post
Replies
Boosts
Views
Activity
I have an app that shows some data in a widget. When that data is changed on another device, it's supposed to sync to the current device, which works fine.
But the widget doesn't sync until I send the app into foreground (and then the sync happens), which is bad because the widget data should always be up-to-date.
I'm using this Apple guide - https://developer.apple.com/documentation/coredata/mirroring_a_core_data_store_with_cloudkit/setting_up_core_data_with_cloudkit to sync Core Data and CloudKit with slight modifications.
How can I sync widgets in the background?
Thank you in advance!
I get this error when I try to run unit tests (yes, it says "UI testing", but I don't have any UI tests). On both simulator and device, whether I run/build the app before or not. How do I solve this?
When I try to add HealthKit capabilities to my app, I get the following signing errors:
Communication with Apple failed. Your account does not have sufficient permissions to modify containers.
Provisioning profile "iOS Team Provisioning Profile: com.domain.app" doesn't support the HealthKit capability.
Provisioning profile "iOS Team Provisioning Profile: com.domain.app" doesn't include the com.apple.developer.healthkit and com.apple.developer.healthkit.access entitlements.
In my developer account, the HK capability is enabled. And the entitlements needed are automatically generated by Xcode when I add HK capability, if I try to add them, it says they're already there.
I have automatically managed signing selected. Clinical health records are not enabled for Health Kit. Common solutions like cleaning, derived data, and restarts don't help.
Does anybody know what this is?
For example, Voice Memos and Timer both show up in dynamic island, but have different behaviors on lock screen: Timer shows up as a live activity, and Voice Memos shows up in dynamic island.
How do I make my live activity show up in dynamic island on lock screen instead of as a live activity?