Post not yet marked as solved
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()
}
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.
Post not yet marked as solved
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.
Post not yet marked as solved
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'"
Post not yet marked as solved
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()
		}
}
Post not yet marked as solved
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 {
		var scale: Double
		var body: some View {
				GeometryReader { geometry in
						VStack {
								ForEach(0..<Int(geometry.size.height)/Int(1/self.scale), id:\.self) { y in
										Text(String(Double(y)/4.0)).position(x: geometry.size.width/2, y: CGFloat(y)).font(.system(size: 8.0)).foregroundColor(.gray)
								 }
						}
				}
		}
}
So, how exactly does one break this up?
Post not yet marked as solved
I've wanted to build an Audio Unit for a while, so I started looking at the current docs, which seem to suggest that I ought to build an app extension, which starts with choosing what kind.However, on Xcode 10, these choices aren't available. Indeed, it seems that the whole concept has been erased from Xcode, and the only programming guides are seemingly deprecated.In fact, I often run into situations where the class documentation, which seems to be up to date never the less refers to programming guides which are marked as no longer being updated.Was there some announcement I missed? It feels like this has been going on for the better part of a couple years.