Hello,
MusicPropertySource.catalog says it is available in the docs on macOS, but .library is not. Is that an oversight? How does this integrate with current uses of iTunesMusicLibrary framework and ITLibrary?
Thank you,
-- Greg Bolsinga
Post
Replies
Boosts
Views
Activity
Hello,
I have an Xcode project (not a workspace), that depends upon a swift package found on GitHub. You can find the PR here that demonstrates the problem. https://github.com/bolsinga/MissingArt/pull/2
My project has a Swift Package dependency. It's a macOS target. If I Cmd-B in Xcode it will build and run just fine (finding the package and building it too). If I xcodebuild -verbose from the command line in CI, it will fail.
The problem is that when the application files compile and import the module found in the Swift Package, the module is not found.
If this were ObjC, I'd know that the search path was not found. I do not see anything about my module on the link line. I have followed the instructions about adding a Swift Package Mgr dependency, and it works locally.
I'm sure that I'm missing one small thing; I'm not sure if xcodebuild with no options (thus getting the default behavior) is the proper thing to do.
Any ideas?
Thank you,
-- Greg
NavigationSplitView does not run .task for each detail view instance. I'm trying to update my code from NavigationView to NavigationSplitView. I was having trouble, since I rely upon .task to update the @State of my detail view. It does not update this state in the detail view when using NavigationSplitView. Please see my comments in the code snippet below. Does anyone have any suggestions? FWIW I have also filed FB11932889.
Thanks for any help.
import SwiftUI
enum Category: CaseIterable, Hashable {
case first
case second
}
struct CategoryRow: View {
let category: Category
var body: some View {
Text("Row: \(String(describing: category))")
}
}
struct CategoryDetail: View {
enum LoadingState {
case none
case loading
case loaded
case error
}
let category: Category
@State private var loadingState: LoadingState = .none
var body: some View {
VStack {
Text("Category: \(String(describing: category))")
Text("LoadingState: \(String(describing: loadingState))")
}
.task {
// If this .task does not run ever, the view will show a .none Category.
// If this .task runs, the view will start by showing .loading, and then .loaded
// The bug found when this is in CategoryNavigationSplitView that: this .task does not run for the .second category,
// but the @State is not reset, it will show .loaded for the second category chosen!
// I expect this .task to run each time, and not carry over the @State from
// previous CategoryDetail. It must be a new CategoryDetail View, since the
// let Category constant is changing.
// When this is in CategoryNavigationView, the .task runs as expected.
loadingState = .loading
do {
try await Task.sleep(for: .seconds(2))
loadingState = .loaded
} catch {
loadingState = .error
}
}
}
}
struct CategoryNavigationSplitView: View {
@State var selectedCategory: Category?
var body: some View {
NavigationSplitView {
List(Category.allCases, id: \.self, selection: $selectedCategory) { category in
NavigationLink(value: category) { CategoryRow(category: category) }
}
} detail: {
if let selectedCategory {
CategoryDetail(category: selectedCategory)
} else {
Text("Select a Category")
}
}
}
}
struct CategoryNavigationView: View {
@State var selectedCategory: Category?
var body: some View {
NavigationView {
List(Category.allCases, id: \.self, selection: $selectedCategory) { category in
NavigationLink {
CategoryDetail(category: category)
} label: {
CategoryRow(category: category)
}
}
}
Text("Select a Category")
}
}
Hello, I'm having trouble understanding Focus in SwiftUI on macOS for my application. I have distilled it down to a small reproducible case here.
struct ContentView: View {
struct Item : Identifiable, Equatable, Hashable {
let id : Int
let url : URL
@ViewBuilder var view : some View {
if id % 2 != 0 {
AsyncImage(url: url)
} else {
Image(systemName: "questionmark.diamond")
}
}
}
struct DetailView : View {
@Binding var item: Item?
var items : [Item] {
if let item {
return [item, item]
}
return []
}
var body: some View {
List(items) { item in
item.view
}
}
}
var url : URL {
return URL(string: "https://is1-ssl.mzstatic.com/image/thumb/Music/4c/aa/6f/mzi.cnwthgxu.jpg/900x900bb.jpg")!
}
var items : [Item] {
var a : [Item] = []
for i in 0..<10 {
a.append(Item(id: i, url: url))
}
return a
}
@State private var selectedItem : Item?
var body: some View {
NavigationSplitView {
List(items, selection:$selectedItem) { item in
NavigationLink(value: item) {
Text("\(item.id)")
}
}
} detail: {
DetailView(item: $selectedItem)
}
}
}
If you click on an even row, the behavior is as expected. The side List highlights. Press the Tab key. Nothing highlights, but I assume focus is in the DetailView. Press the Tab key a second time. It will now highlight the focus on the side bar show/hide button in the toolbar. Press the Tab key again, and it will go back to the side view list’s selection.
If you click on an odd row, the behavior is not as expected. The side List highlights. Press the Tab key. Nothing highlights, but I still assume focus is in the DetailView. Press the Tab key a second time. This time, instead of focusing the sidebar show/hide button, nothing highlights again. I still assume focus is in the DetailView, but it is not clear what. Now press the Tab key again, and the highlight focuses on the sidebar show/hide button.
I’m confused why two Images (one from Image(systemName:) and the other from an URL via AsyncImage) have different Tab key behavior. Why does AsyncImage seem to capture the two images, while the SF Symbols Images do not? Why does anything in the DetailView capture focus at all?
Thanks for any tips!
FB12044843
The new Map builder SwiftUI is awesome. Does it support cluster annotations? I have opened FB12244017. Thank you very much!
Hello,
I am running a virtual machine on my Apple Silicon Mac, using the sample Xcode project provided by Apple last year. I have Ventura 13.4 installed on on the host and the VM. I try to enter my Apple ID credentials in "Sign In with Apple ID" in the VM so I may then update this VM to Sonoma. I am sure I am getting my password correct. I cannot log in. Please see the screen shot.
Am I supposed to be able to do this? I can log into developer.apple.com within the VM OK.
Thank you.
FB12263051
Hello, I'm having a hard time with Universal Links and my app.
This looks good:
$ curl -I https://www.bolsinga.com/.well-known/apple-app-site-association HTTP/1.1 200 OK Date: Mon, 12 Jun 2023 22:10:57 GMT Server: Apache/2.4.29 (Ubuntu) Last-Modified: Mon, 12 Jun 2023 20:53:38 GMT ETag: "1eb-5fdf4e9bcb926" Accept-Ranges: bytes Content-Length: 491 Content-Type: application/json
This looks good in my entitlements:
<key>com.apple.developer.associated-domains</key> <array> <string>applinks:www.bolsinga.com</string> </array>
The screenshot below good too (from Settings -> Developer -> Universal Links -> Diagnostics).
If I have a link like https://www.bolsinga.com/dates/sh624.html in Notes.app, and I tap on the link it will open in Safari. If I tap and hold, it will not suggest my application. It seems like my universal links should work. Am I doing it wrong? I thought it meant if I opened the URL in these ways it would open in my app.
Thanks for your help!
@eskimo Hi! I tried out this new download. I'd installed it on the Ventura host and in the Sonoma VM, but the Sonoma Beta 1 VM does not "see" Beta 2.
https://developer.apple.com/download/
How do we update our VM running macOS 14 beta 1 to beta 2? Thanks!
Device Support for macOS 14 beta 2
Install Device Support for macOS 14 beta 2 if installing the macOS Seed in a virtual Machine fails on a host Mac.
Released
June 21, 2023
Build
1700B21
Download Device Support Image
Device Support for macOS 14 beta 2
1700B21
I have enabled “StrictConcurrency” warnings in my project that uses SwiftUI. I have a Commands struct. It has a Button, whose action is calling an async method via Task{}. This builds without warnings within Views, but not Commands. There the compiler reports “Main actor-isolated property 'body' cannot be used to satisfy nonisolated protocol requirement”.
Looking at SwiftUI:
In View, body is declared @MainActor:
@ViewBuilder @MainActor var body: Self.Body { get }
In Commands, body is not declared @MainActor:
@CommandsBuilder var body: Self.Body { get }
So the common practice of making a Button action asynchronous:
Button {
Task { await model.load() }
} label:{
Text("Async Button")
}
will succeed without warnings in Views, but not in Commands. Is this intentional? I've filed FB13212559. Thank you.
Hello,
On macOS I can use the defaults command line tool to reset or modify @AppStorage data outside the application.
Where is @SceneStorage data stored? Alternately, how do I reset my application back to "it's not yet stored"?
Thank you for any tips!
Hello,
When I use xcstrings in my app, and I have my scheme's localization debugging enabled (when it renders all caps for any non-localized text).
Prior to converting to xccstrings, my app shows non caps text for everything. After I convert to xcstrings, some of my app shows caps text for some items. I can see the keys in the xccstrings that I expect, so I do not think it is a bug in the conversion. Could it be a bug in the renderer somehow?
FB13261276
Thanks!
-- Greg
If I convert my SPM from .strings to .xcstrings it will fail to build when using swift build. It builds from Xcode 15. My UI code uses bundle: .module so the localized strings are found properly. See https://github.com/bolsinga/site/pull/685 for the change (as well as the action log).
Does SPM build somehow not know that .xcstrings in a Resource directory make the build a "bundle build"?
I filed FB13261704
Thanks!
I'm using iCloud Music Library. I’m using macOS 14.1 (23B74) and iOS 17.1.
i’m using MusicKit to find songs that do not have artwork. On iOS, Song.artwork will be nil for items I know do not have artwork. On macOS, Song.artwork is not nil. However when the songs are shown in Music.app, they do not have Artwork. Is this expected? Alternately, is there a more correct way to determine that a Song has no Artwork?
I have also filed FB13315721.
Thank you for any tips!
Hello,
I have a SwiftUI application that uses NavigationSplitView. It's working great on iOS, iPad, and macOS. I decided to give it a try on tvOS. After it builds, it will not allow user interaction on the NavigationSplitView's sidebar. I've tried various view focus modifiers without any success. I'd also expect this to "just work" as default behavior. I have filed FB13447961 on this issue. Here is a distillation of the code that demonstrates the problem. Any ideas? Thank you.
enum Category : String, CaseIterable {
case first
case second
case third
}
enum Detail : String, CaseIterable {
case one
case two
case three
}
struct DetailView : View {
let category : Category?
var body: some View {
if let category {
Text(category.rawValue)
List(Detail.allCases, id: \.self) { detail in
NavigationLink(value: detail) {
Text(detail.rawValue)
}
}
} else {
Text("Select Category")
}
}
}
struct ContentView: View {
// NOTE: If this category is set to something, it will show that category's detail.
// The problem is that the NavigationSplitView sidebar does not have, nor does not
// seem to be able to get focus.
@State var category: Category?
@State var path : [Detail] = []
var body: some View {
NavigationSplitView {
List(Category.allCases, id: \.self, selection: $category) { category in
Text(category.rawValue)
}
} detail: {
NavigationStack(path: $path) {
DetailView(category: category)
.navigationDestination(for: Detail.self) { detail in
Text("\(detail.rawValue)")
}
}
}
}
}
#wwdc2023-10162 #wwdc20-10042
Hello, Awhile ago I'd refactored my code to have @SceneStorage in a ViewModifier and not on a View. In Xcode 15.3, I see a runtime-only warning:
SceneStorage is only for use with SwiftUI App Lifecycle. This will become a fatal error in a future release.
Accessing a SceneStorage value outside of being installed on a View. This will always return the default value.
Creating a Binding to SceneStorage value outside of being installed on a View. This will result in a constant Binding of the default value and will not update.
I'd used a ViewModifier to encapsulate this code. Why is that different than a View?
If you are interested you can see an example here: https://github.com/bolsinga/site/blob/ffbedd7fb134675496f529cf62484ceb9b79d360/Sources/Site/Music/UI/ArchiveStorageModifier.swift#L15
Thanks for any tips!