Post

Replies

Boosts

Views

Activity

PKToolPicker Available Tools
When I display the PKToolPicker in my app it looks similar to the image below If you use one of the apps from Apple like Pages or Freeform you see a picker similar to this one. Notice that the PKToolPicker from the Apple app has 6 tools not including the ruler. With the tool all the way to the left being the writing tool. How do you get the picker to display with the writing tool? I have looked over the API and I can see where you can set if the ruler is displayed or not but I can't find anything for the writing tool
1
0
840
Nov ’23
Swift Charts Axis Adjustment
I am working on a Mac app that uses Swift Charts to visualize some data. I can initially plot the data fine. The problem is that I want the ability to "zoom" in on the data. to do this I change the range of the x or y axis using the following modifiers .chartXScale(domain: xMin...xMax) .chartYScale(domain: yMin...yMax) I use a drag gesture to change the values of xMin and xMax for example to zoom in on the data. This does have the effect that I want but the problem is it causes the line to start moving out of the chart area like show below. I don't understand why this is happening. I thought by changing the scale it would cause only the data that is visible on the chart to be displayed.
1
0
1k
Mar ’23
How to create proper array time at runtime in Swift
I am writing a MacOS application that reads in a binary data file. The file is broke up into two sections. The first section of the file lists all the information about each channel in the file. For example the channel name, the unit of measure, the type of the data. The possible types are know in advance. For example a channel could be UInt8, Int16, float, etc. The second part of the file is the data. Each set of points starts with a timestamp followed by all of the channel values for that sample in the same order that they are in the header. This pattern repeats until the end of the file. I have a class model that will store all of the information about the channel along with an array containing all of the data for that channel. My question is how could I approach the array for the data in each channel. I won't know in advance what type each channel is until I read the file. I could have an array of each possible type in the model but that feels like a bit of a waste. Is there any way I could either create the array at runtime to the proper type or change the array type at runtime? I am using swift 5.
2
0
702
Feb ’22