Post

Replies

Boosts

Views

Created

Create CGColorSpace from CFPropertyList
I am trying to create a custom CGColorSpace in Swift on macOS but am not sure I really understand the concepts. I want to use a custom color space called Spot1 and if I extract the spot color from a PDF I get the following: "ColorSpace<Dictionary>" = { "Cs2<Array>" = ( Separation, Spot1, DeviceCMYK, { "BitsPerSample<Integer>" = 8; "Domain<Array>" = ( 0, 1 ); "Filter<Name>" = FlateDecode; "FunctionType<Integer>" = 0; "Length<Integer>" = 526; "Range<Array>" = ( 0, 1, 0, 1, 0, 1, 0, 1 ); "Size<Array>" = ( 1024 ); } ); }; How can I create this same color space using the CGColorSpace(propertyListPlist: CFPropertyList) API func createSpot1() -> CGColorSpace? { let dict0 : NSDictionary = [ "BitsPerSample": 8, "Domain" : [0,1], "Filter" : "FlateDecode", "FunctionType" : 0, "Length" : 526, "Range" : [0,1,0,1,0,1,0,1], "Size" : [1024]] let dict : NSDictionary = [ "Cs2" : ["Separation","Spot1", "DeviceCMYK", dict0] ] let space = CGColorSpace(propertyListPlist: dict as CFPropertyList) if space == nil { DebugLog("Spot1 color space is nil!") } return space }
0
0
753
Dec ’23
How does one create a DataStoreSnapshot for a custom data store ?
The WWDC2024 custom data store example doesn't provide any details on how one would go about creating a DataStoreSnapshot. The example uses a DefaultSnapshot for persisting the data in the DefaultSnapshot format directly in the JSON file. There appears to be no documentation or examples of how one might create a DataStoreSnapshot from data from another database. The Apple documentation for DefaultSnapshot provides no examples of how one might create such a snapshot from data retrieved elsewhere. Can anyone provide a simple example of how one might create such a snapshot from a remote database such that it can be returned as part of the response to a fetch request. For the purpose of this example let's assume I have a CSV file with rows of data and code to read the data from this file. How would I create a snapshot or snapshots for each of the rows of data.
1
0
808
Oct ’24
Example of creating NSView with custom bindings
Does anyone know where I can find an example of creating a NSView subclass with custom bindings. I need to be able to bind to the object in interface builder. This is the only reference in Apple documents but as is often the case there appear to be no examples. https://developer.apple.com/documentation/objectivec/nsobject/nskeyvaluebindingcreation
0
0
198
Oct ’24
Help creating notarised DMG for macOS app distribution
I am trying to follow the guide for automating creation of a DMG for distribution of a macOS application but can't figure out how to get the ExportOptions.plist from a manual export. I am trying to follow this guide: https://developer.apple.com/documentation/security/customizing-the-xcode-archive-process What is a 'manual export' and what are the steps for creating a manual export. `# Ask xcodebuild(1) to export the app. Use the export options # from a previous manual export that used a Developer ID. /usr/bin/xcodebuild -exportArchive -archivePath "$ARCHIVE_PATH" -exportOptionsPlist "$SRCROOT/ExportOptions.plist" -exportPath "$EXPORT_PATH"` Where is "$SRCROOT" ? presumably I have to copy this ExportOptions.plist to this location. Thanks - I am sure this must be blindingly obvious because there seems to be no reference as to how you do this 'manual export' or where one finds the resulting options file.
1
0
196
Mar ’25