Posts

Post marked as solved
3 Replies
408 Views
For some time, whenever I use ⌘⇧A (command + shift + A) to toggle appearance from light to dark mode, nothing happens. The same hen pressing the Features > Toggle Appearance in the menu item. I saw a mention about this issue in https://developer.apple.com/forums/thread/707994?answerId=716995022#716995022 For that, I assume it may not be a systematic issue, but a problem with some cached file or something in the simulator and/or Xcode project
Posted Last updated
.
Post not yet marked as solved
1 Replies
385 Views
I've been building our app to make a release in App Store with Xcode Cloud Currently the builds are failing with the following error: The value of CFBundleShortVersionString in your WatchKit app's Info.plist (3.9.0) does not match the value in your companion app's Info.plist (4.7.0). These values are required to match. This is strange, as in our ci_pre_xcodebuild script we have an invocation of the code echo "Version: ${versionNumber}" echo "Setting version string in plists" echo "iOS Version:" /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $versionNumber" $CI_WORKSPACE/MainApp/Resources/Plists/Info.plist /usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString $versionNumber" $CI_WORKSPACE/MainApp/Resources/Plists/Info.plist echo "Watch Version:" /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $versionNumber" $CI_WORKSPACE/WatchApp/Info.plist /usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString $versionNumber" $CI_WORKSPACE/WatchApp/Info.plist echo "Watch Extension Version:" /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $versionNumber" $CI_WORKSPACE/WatchAppExtension/Resources/Info.plist /usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString $versionNumber" $CI_WORKSPACE/WatchAppExtension/Resources/Info.plist On which the command executes correctly and shows the right output. Then I don't understand what's going on. This workflow was working a couple weeks ago and we haven't done a change to it since then. Any ideas of what could it be?
Posted Last updated
.
Post not yet marked as solved
4 Replies
649 Views
There was another post - https://developer.apple.com/forums/thread/651748 asking how to use @FocusedBinding . I'm trying to use @FocusedBinding in the following context. I have a view that contains a @State array property of type [DeckViewModel] Within the view, I display the list of those models I can tap on one item to select it, storing that selection in a @State var currentDeck: DeckViewModel? property. Then I define the properties needed to use @FocusedBinding struct FocusedDeckKey : FocusedValueKey {     typealias Value = Binding<DeckViewModel?> } extension FocusedValues {     var currentDeck: FocusedDeckKey.Value? {         get { self[FocusedDeckKey.self] }         set { self[FocusedDeckKey.self] = newValue }     } } And set the value in the view .focusedValue(\.currentDeck, $appState.currentDeck) Finally, in the struct I try to set the preferences I use it like: struct AppCommands: Commands {     @FocusedBinding(\.currentDeck) private var currentDeck: DeckViewModel? } Then I get the following error: ❌ Type of expression is ambiguous without more context Which makes sense, as the FocusedValues.currentDeck is of type Binding<DeckViewModel?>? So the syntax of @FocusedBinding(\.currentDeck) private var currentDeck: DeckViewModel? is not correct for these types. But I am not sure how to express this correctly. The idea of the binding to an optional value seems ok to me, but it brings this complexity regarding the types and this API. Then. How can I make @FocusedBinding work with this optional? or How should I solve this issue? considering I'm trying to represent the selection of an item of a list Thanks
Posted Last updated
.
Post marked as solved
1 Replies
221 Views
I have the following scenario that I want to implement import SwiftUI struct Deck: Identifiable {     var id: String { name }     var name: String } struct DemoListView: View {     @State var decks: [Deck] = [         Deck(name: "Dark Magician"),         Deck(name: "Eldlich"),         Deck(name: "Hero"),         Deck(name: "Hero Isolde"),         Deck(name: "Orcust"),         Deck(name: "Dino"),         Deck(name: "Salamangreat"),         Deck(name: "Sky Striker"),     ]     var body: some View {         NavigationView {             List {                 ForEach(0..<decks.count) { index in                     DemoItemView(text: decks[index].name)                 }             }             .listStyle(SidebarListStyle())             .frame(minWidth: 200, alignment: .leading)         }     } } struct DemoItemView: View {     @Binding var text: String     @State var isEditing: Bool = false     var body: some View {         Group {             if isEditing {                 TextField(text, text: $text, onCommit: { isEditing.toggle() })                     .textFieldStyle(PlainTextFieldStyle())             } else {                 HStack {                     Text(text)                         .font(.headline)                     Spacer()                 }             }         }     } } In summary: I have a list of Deck models I want to display them on a List If an element of the list is double tapped then I will toggle the element's isEditing property when the text is editing, I will use a TextField that needs a binding to the edited text the text comes from a property of Deck, which is an element in the array The line of code DemoItemView(text: decks[index].name) Is not correct, but this is why I am trying to achieve. I'm trying to get a binding to an element of the collection if that's even possible. Maybe I took the wrong approach to solve this problem, if so I would like some advice. At the end I want to implement a list of element and be able to edit inline the text of those elements (in macOS).
Posted Last updated
.