Closed TechGeekGamer closed 1 month ago
Hey,
i am currently using the Xcode 16 beta and the latest MacOS public beta and it seems like older toolchains have a problem building AmpFin. Here are the modifications I had to make to be able to build the project using the latest stable tools:
diff --git a/AmpFinKit/Sources/AFFoundation/Item.swift b/AmpFinKit/Sources/AFFoundation/Item.swift
index f7e0d5a..b8ad83a 100644
--- a/AmpFinKit/Sources/AFFoundation/Item.swift
+++ b/AmpFinKit/Sources/AFFoundation/Item.swift
@@ -88,7 +88,7 @@ public extension Item {
static let affinityChangedNotification = NSNotification.Name("io.rfk.ampfin.item.affinity")
}
-extension Item.ReducedArtist: Identifiable, Hashable, Equatable {}
+// extension Item.ReducedArtist: Identifiable, Hashable, Equatable {}
public extension Item {
var sortName: String {
diff --git a/Multiplatform/Album/AlbumView+Toolbar.swift b/Multiplatform/Album/AlbumView+Toolbar.swift
index dd34b20..26cfa9d 100644
--- a/Multiplatform/Album/AlbumView+Toolbar.swift
+++ b/Multiplatform/Album/AlbumView+Toolbar.swift
@@ -131,7 +131,7 @@ private struct ToolbarMenu: View {
viewModel.queue(now: $0)
}
- ForEach(viewModel.album.artists) { artist in
+ ForEach(viewModel.album.artists, id: \.id) { artist in
Divider()
NavigationLink(value: .artistLoadDestination(artistId: artist.id)) {
diff --git a/Multiplatform/Collections/Tracks/TrackCollection.swift b/Multiplatform/Collections/Tracks/TrackCollection.swift
index 931e662..dfc8a59 100644
--- a/Multiplatform/Collections/Tracks/TrackCollection.swift
+++ b/Multiplatform/Collections/Tracks/TrackCollection.swift
@@ -152,7 +152,7 @@ internal extension TrackCollection {
}
}
- ForEach(track.artists) { artist in
+ ForEach(track.artists, id: \.id) { artist in
NavigationLink(value: .artistLoadDestination(artistId: artist.id)) {
Label("artist.view", systemImage: "music.mic")
Text(artist.name)
diff --git a/Multiplatform/NowPlaying/Buttons.swift b/Multiplatform/NowPlaying/Buttons.swift
index cec2653..0e36c4c 100644
--- a/Multiplatform/NowPlaying/Buttons.swift
+++ b/Multiplatform/NowPlaying/Buttons.swift
@@ -11,6 +11,7 @@ import AFPlayback
import AVKit
extension NowPlaying {
+ @MainActor
struct Buttons: View {
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
@Environment(ViewModel.self) private var viewModel
diff --git a/Multiplatform/NowPlaying/Lyrics.swift b/Multiplatform/NowPlaying/Lyrics.swift
index bafb254..e03baf9 100644
--- a/Multiplatform/NowPlaying/Lyrics.swift
+++ b/Multiplatform/NowPlaying/Lyrics.swift
@@ -10,6 +10,7 @@ import AmpFinKit
import AFPlayback
internal extension NowPlaying {
+ @MainActor
struct Lyrics: View {
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
@Environment(ViewModel.self) private var viewModel
@@ -96,6 +97,7 @@ internal extension NowPlaying {
}
}
+@MainActor
private struct Line: View {
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
@Environment(LyricsViewModel.self) private var lyricsViewModel
diff --git a/Multiplatform/NowPlaying/Title.swift b/Multiplatform/NowPlaying/Title.swift
index 92e79b2..f69416e 100644
--- a/Multiplatform/NowPlaying/Title.swift
+++ b/Multiplatform/NowPlaying/Title.swift
@@ -125,7 +125,7 @@ private struct ArtistsMenu: View {
}
}
- ForEach(track.artists) { artist in
+ ForEach(track.artists, id: \.id) { artist in
Button {
Navigation.navigate(artistId: artist.id)
} label: {
diff --git a/Multiplatform/Utility/DisplayContext.swift b/Multiplatform/Utility/DisplayContext.swift
index 36aad78..9c323b9 100644
--- a/Multiplatform/Utility/DisplayContext.swift
+++ b/Multiplatform/Utility/DisplayContext.swift
@@ -19,7 +19,3 @@ internal enum DisplayContext: Identifiable, Equatable, Hashable {
self
}
}
-
-extension EnvironmentValues {
- @Entry var displayContext: DisplayContext = .unknown
-}
diff --git a/Multiplatform/Utility/LibraryDataProviders/LibraryDataProvider.swift b/Multiplatform/Utility/LibraryDataProviders/LibraryDataProvider.swift
index 378db65..f0303fa 100644
--- a/Multiplatform/Utility/LibraryDataProviders/LibraryDataProvider.swift
+++ b/Multiplatform/Utility/LibraryDataProviders/LibraryDataProvider.swift
@@ -45,6 +45,13 @@ public protocol LibraryDataProvider {
// MARK: Environment
+struct LibraryDataProviderDefault: EnvironmentKey {
+ static var defaultValue: LibraryDataProvider = MockLibraryDataProvider()
+}
+
public extension EnvironmentValues {
- @Entry var libraryDataProvider: LibraryDataProvider = MockLibraryDataProvider()
+ var libraryDataProvider: LibraryDataProvider {
+ get { self[LibraryDataProviderDefault.self] }
+ set { self[LibraryDataProviderDefault.self] = newValue }
+ }
}
Hello! I was trying to build your project in Xcode using your provided guide in the README, but keep getting an error. If it's helpful to know, I am using Xcode Version 15.4 (15F31d) on a Macbook Pro running macOS Sonoma 14.5 (23F79). Here is the error I am getting:
AmpFin/AmpFinKit/Sources/AFFoundation/Item.swift
I am on the latest commit (d823cb72fc6bd528bbf3d3d99f7bc5b681604680) and have not made any changes to the codebase besides the Debug.xconfig and removing the Siri entitlement (because otherwise it'd error, because I have a non-paid developer member account).
Could you let me know where I may be going wrong by missing a step or something? Thanks in advance!