Thanks to the tip from @hacknicity, here's an example in Swift for UIKit:
var descriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .largeTitle)
let traits: [UIFontDescriptor.TraitKey:Any] = [.width: -1.0]
descriptor = descriptor.addingAttributes([.traits: traits])
let uiFont = UIFont(descriptor: descriptor, size: descriptor.pointSize)
This creates a narrow version of the "large title" text style.
According to the header file, the width value should be a float between -1.0 to 1.0. -1.0 will give you a narrow width, 0.0 is a normal width, and 1.0 is wide. There are options between those values—for example 0.25 gave me a width that's just a bit more narrow than normal.
It seems there's not a direct equivalent of UIFontDescriptor in SwiftUI. However, you can create a SwiftUI Font from a UIFont. Just add one more line to the example above:
let font = Font(uiFont as CTFont)
I imagine this will become easier to use in a later beta.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Same here. I looked through the profiles in ~/Library/MobileDevice/Provisioning Profiles but none of them seemed to be expired. Regardless, I quit Xcode, deleted the entire folder, relaunched Xcode, and the problem seems to be fixed now.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags:
I'm seeing the same issue with the release candidate. Did you ever find a solution or workaround?
In my case this is happening with a custom subclass of NSSearchField.
Topic:
UI Frameworks
SubTopic:
AppKit
Tags:
I've tested various options for custom attachment drawing, and the only one I can get to work consistently on macOS 15.0 Release Candidate is setting the image property of the text attachment. I'm using NSImage.init(size:flipped:drawingHandler:) to do custom drawing, similar to what I was previously doing in NSTextAttachmentCell.draw(withFrame:in:characterIndex:). I also set the bounds of the text attachment to adjust the position of the attachment, which I was previously doing with NSTextAttachmentCell.cellBaselineOffset(). The one thing I haven't been able to accomplish with this approach is changing the appearance of the attachment when it's selected.
I also experimented with view-based text attachments, using NSTextAttachmentViewProvider. This worked well in an NSTextView, but in an NSTextField or NSSearchField, the custom view would only show when the text field was first responder. I can't find any clear documentation on how view-based text attachments are meant to be used, so I'm not sure if there's any way to work around that problem.
I've filed a bug report on this issue, FB15109146.
Topic:
UI Frameworks
SubTopic:
AppKit
Tags: