Post

Replies

Boosts

Views

Activity

Reply to Problem with my files disappear in xcode
are you sure you have a ContentView.swift file on disk? You say "all my files were gone" but I only see one that Xcode can't find. Where does Xcode think it is? Click on the file ContentView in the file navigator on the left, open the inspectors panel on the right, select the File inspector (the first one). You'll see the Full Path - does it lead where you expect? If the file is present on disk, you can update the path by clicking the little rightward-pointing arrow in a circle next to the path and selecting the file in its actual location.
Mar ’24
Reply to Could not find the main bundle or the Info.plist is missing a CFBundleIdentifier
this looks a little odd to me: "Could not find the main bundle or the Info.plist is missing a CFBundleIdentifier in \U2018MyApp.productbuild.pkg\U2019."; because it is presenting the name of the package inside quoted Unicode LEFT SINGLE QUOTATION MARK and RIGHT SINGLE QUOTATION MARK. I'd expect plain quotation marks. Take a careful look at the contents of your scripts and make sure you're not copying a command line from a text editor (such as Word) that likes to convert written ' and " to curly quotes.
Mar ’24
Reply to How to achieve this gradient and the translucent text in SwiftUI?
something like this should get you started. You'd probably want to put any custom colors into an Asset, not hard-code them like this. All the colors I made here are transparent, so my white background shows through. I found many relevant samples quite quickly by searching the Internet for "SwiftUI gradient" and "SwiftUI custom color" and "SwiftUI filled rectangle". Did you do the same? If you didn't, you really should have... extension Color { static let pink = Color(red: 0.8, green: 0.0, blue: 0.0, opacity: 0.3) static let reddish = Color(red: 1.0, green: 0.0, blue: 0.0, opacity: 0.5) static let darkishRed = Color(red: 1.0, green: 0.0, blue: 0.0, opacity: 0.3) } let gradient = LinearGradient(gradient: Gradient(colors: [.pink, .reddish]), startPoint: .top, endPoint: .bottom) struct ContentView: View { var body: some View { ZStack { RoundedRectangle(cornerRadius: 10) .fill(gradient) .frame(width: 200, height: 200) Text("hello world") .font(.largeTitle) .foregroundStyle(Color.darkishRed ) } } }
Feb ’24
Reply to Xcode debugging through USB
Presumably you are developing an app that runs on something other than a Mac? Connect the destination phone or iPad to the development Mac with a USB cable. The iPad/iPhone will ask if you want to trust the computer. Xcode will take a little while to make the iPad/iPhone ready for debugging. You can monitor its progress using Xcode's Window/Devices and Simulators menu. I don't think there's any control over how Xcode begins debugging - it uses USB if there's a connection, WiFi otherwise. If I break the USB connection mid-session, Xcode does not fail over to WiFi automatically.
Feb ’24
Reply to Using an existing driver with a USB serial chip with custom VID/PID
My first question is "why?" If you're only changing the vid/pid to make the product appear different to anyone else's which is based on a CP2102, do you really need to? Can you figure out whether it is yours by probing the serial interface? Could you just change the vendor and product strings, instead of the IDs? How much user confusion is likely to arise if you just stick with Silicon Lab's vid/pid? All of this dext scaffolding is quite painful to get right. The user is burdened with approval of the dext, but if you didn't change the vid/pid of the CP2102, they would not be, because the Apple dext is pre-approved. I don't know if you can use the recommended approach here, of subclassing from a known DriverKit class, but overriding nothing. This is because AppleUSBSLCOM is specific to the Silicon Labs CP2102, its interface isn't in the DriverKit headers. You can't simply inherit from IOUserUSBSerial, because that driver doesn't know about CP2102, and I don't think you can inherit from AppleUSBSLCOM, because you have no header file for it. I'd try two things: go to /System/Library/DriverExtensions/com.apple.DriverKit-AppleUSBSLCOM.dext and copy the DriverKit-AppleUSBSLCOM-CP2102 IOKitPersonality from it, change the idProduct and idVendor and put that modified dictionary into your driver's plist. Your personality is now referring to an executable which isn't present in your bundle, I don't know if that will work. You may need to ensure that your dext contains some executable code, but this personality won't refer to it. Your code should already generate a do-nothing dext. ensure that your app actually tries to activate your extension using what does systemextensionsctl list tell you? I use log collect --last 20 immediately after activation to give me a workable log archive that isn't too huge and isn't constantly changing where I can read messages which my be pertinent to my dext. I don't use systemextensionsctl developer on any more. Its laughingly poorly documented - what is developer mode, for example (FB7656761) ? As for entitlements, your hosting app needs the System Extension entitlement. Your driver needs DriverKit (a boolean YES), DriverKit USB transport (a dictionary containing an array of idVendors, usually just one), and DriverKit serial family
Feb ’24
Reply to Color not working properly
@Pokka your screen shot is from "Color LCD", which is what Apple calls the built-in display on their laptop. By default, this uses the P3 color space. If you go to Settings/Displays, select the built-in display and change its Preset to "Internet & Web (sRGB)", the Digital Color Meter should show you the values you expect. Alternatively, you can create the color in the P3 color space: let darkorange = Color(.displayP3, red: 213/255, green: 131/255, blue: 120/255) The default display gamut is sRGB, which isn't as wide as P3. So when you create your dark orange in sRGB, then display it in P3, it isn't as colorful as you'd expect.
Feb ’24
Reply to CPU Saturation with Charts real time plotting from data received from Bluetooth
I see it has been a week and no-one has answered. I've never used Swift Charts, but I'll take a stab at this. You're feeding four channels of data at 2400 samples/sec into an ever-growing array of structs. Each sample struct (VoltagePerTime) contains a string with the channel name, but the channel name probably doesn't change from one sample to the next sample in a given channel, right? So why not infer the channel name from the array you put the sample into. Then you don't store a bunch of identical strings in your sample array. Are the samples arriving at constant intervals? If so, the time can be inferred from the position in the array, so you don't need to store the time. At most, you would need to store the start time of each sample set. I assume the samples arrive in strictly monotonic time order. However, your ChartView filter closure examines every sample you have collected, to see if it falls within the time you wish to graph. As your sample set grows, simply fetching the samples in your graph window takes longer and longer. You should consider using a smarter algorithm to select the data that you pass to the graph, using what you know in advance about the data. Store as little as possible, prefer numbers to strings. Also, you have @Published every array. But if your graph is currently viewing the first 2 seconds of data, while you collect the tenth second, nothing is going to change on screen, but you're nevertheless asking the ChartView's body property to be re-evaluated. If you leave your app running for long enough, you're going to run out of memory, so you should consider implementing some kind of persistent buffer for your data, or a circular in-memory buffer, or both. There are further optimizations you could consider, but these suggestions may be enough to give you acceptable performance so that you can get on with the rest of the project.
Feb ’24
Reply to Handling data from bluetooth device
Is this a Bluetooth, or a Bluetooth Low Energy device? Is it yours (do you own the firmware, and know what it does)? Or is it a device from a third party that you would like to use? The easiest type of device to support is BLE. Have you looked here: https://developer.apple.com/bluetooth/ ? If you've never done this before, start with the Heart Rate Monitor app and use an off-the-shelf heart rate monitor. The Heart Rate Monitor profile is a published standard profile. If you're comfortable with it, you can also use a low-cost BLE development kit to make your own BLE device, with any profile you like, using chips from TI, Maxim IC, Silicon Labs, Nordic, Dialog etc
Jan ’24
Reply to Xcode 15.2.0 has a compilation bug leading to incorrect code generation without warnings
you can enable the undefined behavior sanitizer in the Scheme settings under Diagnostics. This produces this warning for me, even for debug builds: runtime error: shift exponent 64 is too large for 32-bit type 'int' SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior There's another, separate build setting, CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER, which did not help here. This forum isn't a place to report bugs - use Feedback Assistant for that. Undefined behavior really is undefined, you just got away with it before.
Jan ’24