Posts

Post not yet marked as solved
1 Replies
307 Views
I'm getting this message in a launchd log. The service in question is a Focusrite thing. What does it mean? (system/com.focusrite.ControlServer) : cannot spawn: service is in penalty box The peripheral seems to be working fine.
Posted
by hacksaw.
Last updated
.
Post not yet marked as solved
1 Replies
653 Views
I have a cli program which does a thing for a while, and I'd like it to post a notification on the screen when it's done. Note that because it's a standalone program, not an app, it doesn't have a bundle, per se. I tried to use UserNotifications, but I get an immediate error with the line let center = UNUserNotificationCenter.current() With the error: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'bundleProxyForCurrentProcess is nil: mainBundle.bundleURL My entire program to produce this bug: import Foundation import UserNotifications let center = UNUserNotificationCenter.current() print("Hello, World!")
Posted
by hacksaw.
Last updated
.
Post not yet marked as solved
1 Replies
481 Views
Here's some code: import SwiftUI struct RRectPlay: View { var body: some View { Canvas { gc, size in gc.translateBy(x: 20.0, y: 20.0) gc.stroke( Path(roundedRect: CGRect(x: 0.0, y: 0.0, width: 200.0, height: 200.0), cornerSize: CGSize(width: 2.0, height: 2.0)), with: .color(.black), lineWidth: 20.0 ) } } } struct RRectPlay_Previews: PreviewProvider { static var previews: some View { RRectPlay() } } It shows a rounded rect, as requested: If I add the fixedSize modifier to the preview: RRectPlay().fixedSize() The rectangle disappears: If I add a border to see what's happened, I get this: It seems like the definiation of "Ideal Size" ought to be something closer to the bounding box of the figure if there are no other items on the screen. Can anyone elucidate me?
Posted
by hacksaw.
Last updated
.
Post not yet marked as solved
0 Replies
383 Views
Using Xcode 14.0 beta on MacOS 12.4 I have a simple app to play items in the Music library. I'm using MPMusicPlayerController.applicationQueuePlayer to play the music. Nowhere in my project do I refer to the systemMusicPlayer, nor do I have any instances of MPMusicPlayerController() alone. Yet even if I quit the Music app, selecting a new song opens the Music app. The code I use: // inside a View var mainPlayer = MPMusicPlayerController.applicationQueuePlayer //at the end of the HStack representing a single song .onTapGesture { mainPlayer.setQueue(with: MPMediaItemCollection(items: [song])) mainPlayer.prepareToPlay() title = song.title ?? "-- No Title --" mainPlayer.play() }
Posted
by hacksaw.
Last updated
.
Post marked as solved
1 Replies
538 Views
I have a local package and swift algorithms added to the project. I first added them while working on the iOS target. If I switch to other targets, the packages don't work, even if I clear the caches and resolve them again. The import error says "no such module", yet if I go to add the package, it says it can't add it, because it already there. I'm using Xcode 13.2.1.
Posted
by hacksaw.
Last updated
.
Post not yet marked as solved
0 Replies
711 Views
Search on this topic on the web is maddening, because nothing really seems to be complete. I'd like to ask for 2 pathways: Library which comes with Xcode/macOS If I look at my target info panel in the project editor, I can add Frameworks and Libraries. I would like to add libpcre. I hit the "+", scroll down and select libpcre.tbd. It dutifully adds an entry. How do I now use this in a swift file, and see the various functions from the pcre library? Library installed from homebrew 2. Say I have decided that pcre version 1 isn't enough, and I need to add libpcre2. I use "brew install pcre2", which installs the needed file in /usr/local/Cellar/pcre2/10.36/ . How do I now show Xcode how to find these libraries, and use them in my swift file? The Test In both cases, my basic test is that I ought to be able to type let recode = pcreTAB and have Xcode show me the various symbols from the included library.
Posted
by hacksaw.
Last updated
.
Post not yet marked as solved
1 Replies
976 Views
I'm trying to use the MIKMIDI framework. I'm using their source code because I want a particular tag. It builds fine, and passes its own tests. I drag it into the project, and it shows up in the Frameworks folder, but the compiler can't seem to find it. It's target membership is set correctly, Xcode *appears* to see it, and yet I get "No such module 'MIKMIDI'"
Posted
by hacksaw.
Last updated
.
Post not yet marked as solved
0 Replies
539 Views
This code has a behavior that I think might be a bug, but I wanted to check to see if anyone spots a flaw in my thinking. This code makes a scrollable containing a single view which itself encapsulated a longer-than-the-screen list. Note the UnitPoint on line 9, the y: component seems to be a percentage. The bug is that the point requested must be on the screen. In this case, it seems to be around the 12, but with different numbers I get different results. The only time it seems to be consistent is if the current scroll position is at the very top. struct ListVsScrollview: View { 		var body: some View { 				NavigationView { 						ScrollViewReader { sv in 								VStack{ 										Button("Move") { sv. ;sv.scrollTo(72, anchor: UnitPoint(x: 0.0, y: 0.1)) } 										ScrollView { 												VStack { 														Text("Hi").font(.title) 														ForEach(0...100, id: \.self) { number in 																Text("\(number)").font(.title) 														} 														Text("Low").font(.title) 												}.id(72) 										} 										.navigationBarItems(trailing: EditButton()) 								} 						} 				} 		} } struct ListVsScrollview_Previews: PreviewProvider { 		static var previews: some View { 				ListVsScrollview() 		} }
Posted
by hacksaw.
Last updated
.
Post not yet marked as solved
4 Replies
2.3k Views
Once again, the most frustrating and weird error message: "The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions" struct TimePosition: View { &#9;&#9;var scale: Double &#9;&#9;var body: some View { &#9;&#9;&#9;&#9;GeometryReader { geometry in &#9;&#9;&#9;&#9;&#9;&#9;VStack { &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;ForEach(0..<Int(geometry.size.height)/Int(1/self.scale), id:\.self) { y in &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;Text(String(Double(y)/4.0)).position(x: geometry.size.width/2, y: CGFloat(y)).font(.system(size: 8.0)).foregroundColor(.gray) &#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; } &#9;&#9;&#9;&#9;&#9;&#9;} &#9;&#9;&#9;&#9;} &#9;&#9;} } So, how exactly does one break this up?
Posted
by hacksaw.
Last updated
.