Posts

Post marked as solved
3 Replies
748 Views
I'm using this build script: https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow/customizing_the_xcode_archive_process?language=objc To create and notarize a dmg. In Xcode 15 it fails when calling /usr/bin/hdiutil create .... The fail error message is: could not access /Volumes/Bike/Bike.app - Operation not permittedhdiutil: create failed - Operation not permitted I have found that I can work around the problem by giving Xcode 15 full disk access. Is there a way that I can make my script run without having to give Xcode full disk access?
Posted Last updated
.
Post not yet marked as solved
3 Replies
835 Views
Recently (I think when updated to Xcode 14.3) my macOS Shortcut actions (implemented via AppIntent) started having a problem: When I click an action's AppEntity parameter I see the following error instead of seeing a list of entries to select from. The action “Demo Action” could not run because an internal error occurred. One difference that I notice between my builds that didn't exhibit this error and my builds that do exhibit the error: Working builds include objects.appintentsmanifest in the metadata folder Builds that break with the above behavior do not include that file Did something change in recent Xcode? What do I need to do so that Shortcuts app will run my queries again and provide popups so that I can select queried AppEnties? To recreate the problem I created a new Document Based App in Xcode 14.3 and included the following code. I then dragged "Demo Action" into a new Shortcut and clicked "Show More" and then clicked "Books: Choose". import AppIntents struct BookEntity: Identifiable, AppEntity { var id: UUID @Property(title: "Title") var title: String var displayRepresentation: DisplayRepresentation { DisplayRepresentation(title: LocalizedStringResource(stringLiteral: title)) } init(id: UUID, title: String?) { self.id = id self.title = title ?? "Unknown Title" } static var typeDisplayRepresentation: TypeDisplayRepresentation = "Book" static var defaultQuery = BookQuery() } struct BookQuery: EntityStringQuery { func entities(for identifiers: [UUID]) async throws -> [BookEntity] { library.filter { identifiers.contains($0.id) } } func entities(matching query: String) async throws -> [BookEntity] { library.filter { $0.title.localizedCaseInsensitiveContains(query) } } func suggestedEntities() async throws -> [BookEntity] { library } } struct DemoAction: AppIntent { static var title: LocalizedStringResource = "Demo Action" @Parameter(title: "Books") var books: [BookEntity] func perform() async throws -> some IntentResult { .result() } } let library: [BookEntity] = [ BookEntity(id: UUID(), title: "The Hobbit"), BookEntity(id: UUID(), title: "The Lord of the Rings"), ]
Posted Last updated
.
Post not yet marked as solved
0 Replies
745 Views
I am trying to create an AppIntent that takes a rich text parameter. When I try the following it seems to work, but I get compiler errors because AttributedString doesn't conform to Sendable. struct RichTextIntent: AppIntent {     static var title: LocalizedStringResource = "Rich Text"     @Parameter(title: "Text")     var richText: AttributedString     func perform() async throws -> some IntentResult {         .result()     } } Is there a way to accept a rich text parameter without compiler warnings?
Posted Last updated
.
Post not yet marked as solved
1 Replies
557 Views
The problem I am trying to solve is: I have a macOS document based app Each document contains a list of rows I would like to have an AddRowIntent. That intent should take a document as a parameter. I would also like an optional "after row" parameter. When specified the new row will be inserted after that existing row. I want to use DynamicOptionProvider to generate a list of rows in the selected document to choose from, but I'm unsure how to do this. Is it possible? Or what should is the right design in this case, when an Intent has a container and and item in that container as parameters?
Posted Last updated
.
Post not yet marked as solved
1 Replies
760 Views
I am trying to implement text checking in my custom text editor by implementing NSTextCheckingClient, but I can't get anything to work. And I can't find much documentation or any example code anywhere. I have created an example project here: https://github.com/jessegrosjean/NSTextInputClient
Posted Last updated
.
Post not yet marked as solved
0 Replies
543 Views
I have a text cursor that's modeled as a CALayer. It "blinks" with an opacity animation. I'm in process of moving most of my animations away from CAAnimation, and instead I am driving changes myself with a CVDisplayLink. Most of my animations are temporary, things like scroll the window, etc. And when I'm done I pause the CVDisplayLink. My question: Is it reasonable to also drive the text cursor "blink" animation by my CVDisplayLink? That would mean my CVDisplayLink never gets to pause ... but it also means maybe the render server process does get to pause?
Posted Last updated
.
Post not yet marked as solved
1 Replies
774 Views
I have MyLayer and it has a sublayer that it also holds a reference to. In that setup what is the proper way to override init(layer: Any)? Right now I'm doing it like this ... layer.mySublayer.presentation()! is that correct? Is that always going to work, or will presentation ever be nil in this context? Thanks for any tips! class MyLayer: CALayer {     var mySublayer: CALayer     public override init() {         mySublayer = CALayer()         super.init()         addSublayer(mySublayer)     }     override init(layer: Any) {         let layer = layer as! MyLayer         mySublayer = layer.mySublayer.presentation()!         super.init(layer: layer)     }     required init?(coder: NSCoder) {         fatalError("has not been implemented")     } }
Posted Last updated
.
Post not yet marked as solved
0 Replies
580 Views
I have a model CALayer that I animate. I then remove that layer from its super layer. I then wait for a long while After this I'm surprised to see that my model layer still has a non-nil presentation layer. Is this expected behavior? If this is not expected behavior what might make my model layers presentation layer stick around like that? Thanks
Posted Last updated
.
Post not yet marked as solved
0 Replies
750 Views
I am trying to use preference keys to mimic navigationBarTitle behavior. In particular I want a child preference key to bubble up and override one set by parent. In this example I have defined a custom preference key and I set its value twice... right after also setting navigationBarTitle. Notice that the navigationBarTitle value "Home 2" is overriding the "Home 1" value set in parent. I can't figure out how to also override the parent value of my custom preference key. No mater how I change my reducer function the final value is always the value set in parent, value == 1. swift struct MyPreferenceKey: PreferenceKey { static var defaultValue: Int = 0 static func reduce(value: inout Int, nextValue: () - Int) { value += nextValue() } } struct MyPreferenceKeyView: View { @State var preference: Int = 0 var body: some View { VStack { Text("\(preference)") .navigationBarTitle("Home 2") .preference(key: MyPreferenceKey.self, value: 2) } .navigationBarTitle("Home 1") .preference(key: MyPreferenceKey.self, value: 1) .onPreferenceChange(MyPreferenceKey.self) { value in self.preference = value } } }
Posted Last updated
.
Post not yet marked as solved
1 Replies
861 Views
I have a red and a green view. When I "toggle cover" the red view should transition away off the bottom of the screen to reveal the green view. When I "toggle cover" again the red view should transition up from the bottom of the screen to cover the green view. I have this working in the below code, but to make it work I need to use weird scale: 0.9999 value. Is there a better way to do this? I tried using .identity transition. I also tried using .scale(scale: 1.0), but in both cases the green view disappears early... can anyone tell me what's going on? swift import SwiftUI struct TestCoverView: View {     @State private var showCover = true     var body: some View {         VStack {             Button("Toggle Cover") {                 withAnimation {                     showCover.toggle()                 }             }             if (showCover) {                 Color.red                     .edgesIgnoringSafeArea(.all)                     .transition(.move(edge: .bottom))                     .zIndex(1)             } else {                 Color.green                     .edgesIgnoringSafeArea(.all)                     .transition(.scale(scale: 0.9999))             }         }     } }
Posted Last updated
.
Post not yet marked as solved
0 Replies
610 Views
I'm using JavascriptCore in a Swift app. For years I've had this logic:public func doit(_ options: [String : Any]?) { jsValueOutline.invokeMethod("doit", withArguments: [options ?? [:]]) }In particular the logic to turn nil options into a dictionary like this `options ?? [:]`.Now this has started crashing for me. Seems maybe related to 10.15.4 ... though not entirely sure about that. Also is very odd in that I couldn't reproduce the problem for a few days... and now I can't not reproduce the problem. The crash stack looks like this:Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x00007fff6eb583c9 class_conformsToProtocol + 170 1 com.apple.JavaScriptCore 0x00007fff3858d6bd objectToValueWithoutCopy(JSContext*, objc_object*) + 77 2 com.apple.JavaScriptCore 0x00007fff3858cf3a objectToValue(JSContext*, objc_object*) + 74 3 com.apple.JavaScriptCore 0x00007fff3858ed17 -[JSValue invokeMethod:withArguments:] + 151Good news is I can work around the problem by chaning my above code to:publicfunc doit(_ options: [String : Any]?) { jsValueOutline.invokeMethod("doit", withArguments: [options as Any]) }Note the change is to replace `options ?? [:]` with `options as Any`.My question... what happened. Was I don't something wrong initially and it just happened to work? What changed to cause it stop working. Is my "fix" correct?Thanks,Jesse
Posted Last updated
.