Post

Replies

Boosts

Views

Activity

Reply to Can't typing on NSTextField
So the test shows that showSuggestionMenu removes focus. I didn't say that was the solution, just a way of testing. So now, as I suggested before, try to reset focus after updateSuggestionMenu() showSuggestionMenu()
Topic: UI Frameworks SubTopic: AppKit Tags:
Jun ’24
Reply to Moving focus between textfields using enter key
Use FocusState. Here is a simple code example: struct ContentView: View { let textCase1 = 1 let textCase2 = 2 @State var text1: String = "" @State var text2: String = "" @FocusState private var focusedField: Int? var body: some View { VStack { HStack { Text(" TextField 1") TextField("", text: $text1) .border(Color.blue, width: 1) .focused($focusedField, equals: textCase1) .onSubmit { focusedField = 2 } } HStack { Text(" TextField 2") TextField("", text: $text2) .border(Color.red, width: 1) .focused($focusedField, equals: textCase2) .onSubmit { focusedField = 1 } } Button { focusedField = nil print("No more focus") } label: { Text("Do something else") } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’24
Reply to Closure | Error when referring static variable
You can refer to a static variable. As shown in the small code below: struct Preview: View { private static let NAME = "Test" var array: [String] = ["someTest", "Hello", "HelloTest"] var filtered: [String] { array.filter { $0.contains(Preview.NAME) } } var body: some View { ForEach(filtered, id: \.self) { s in Text(s) } } } So the problem is the use in the Query. May be you could try to include in a computed var ?
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’24
Reply to Share settings from SwiftUI in-app settings view to other views
There are several options: use environment var, in a class that groups all the settings AppStorage may be a good option. However, if you have a lot of var, that becomes tedious. How many var have you, of which type ? An idea here is to multiplex the var. imagine you have 8 Int var, which value is in fact between 0 and 255. Then you can create a function to multiplex them: var1 + 256*var2 * 256*256*var3 etc and a demux function, using a succession of % and DIV to get each var back The best would be you show some code so that we can be more specific.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’24
Reply to "Sensitive language" errors
Have a look here: https://forums.developer.apple.com/forums/thread/747146 and here: https://developer.apple.com/forums/thread/746365 Sensitive may be information like your Apple ID or other confidential information. Or some parts are identified as referring for instance to some country code where the robot is suspicious…
Jun ’24
Reply to [iPadOS 18] Make Tabbar back to previous version
Hate is usually a bad adviser… 😇 So you'd better file a bug report, as done here: https://developer.apple.com/forums/thread/756652 But it is likely a definite design choice to save space on iPad (not possible on iPhone probably because of Dynamic Island) and progressively all apps will adopt, so it is probably better to get accustomed to it…
Topic: UI Frameworks SubTopic: UIKit
Jun ’24
Reply to Handling of dates with no value when creating a date bar chart in Charts
All data are shown… but you have to scroll. Add .chartXVisibleDomain to change the scale and see the full range Chart(sessions, id: \.date) { session in BarMark( x: .value("Date", session.date), y: .value("Max RM", session.maxRM) ) } .chartXAxis { AxisMarks(values: .stride(by: .day, count:7)) // 日付の表示間隔を調整 } .chartXVisibleDomain(length: 3600 * 24 * 30) // 30 days in this case .chartScrollableAxes(.horizontal) // 横スクロールを有効にする .padding([.leading, .trailing, .bottom]) Note: totalVolume is shown but as it is zero is a zero height bar.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’24
Reply to Can't typing on NSTextField
So the test shows that showSuggestionMenu removes focus. I didn't say that was the solution, just a way of testing. So now, as I suggested before, try to reset focus after updateSuggestionMenu() showSuggestionMenu()
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Moving focus between textfields using enter key
Use FocusState. Here is a simple code example: struct ContentView: View { let textCase1 = 1 let textCase2 = 2 @State var text1: String = "" @State var text2: String = "" @FocusState private var focusedField: Int? var body: some View { VStack { HStack { Text(" TextField 1") TextField("", text: $text1) .border(Color.blue, width: 1) .focused($focusedField, equals: textCase1) .onSubmit { focusedField = 2 } } HStack { Text(" TextField 2") TextField("", text: $text2) .border(Color.red, width: 1) .focused($focusedField, equals: textCase2) .onSubmit { focusedField = 1 } } Button { focusedField = nil print("No more focus") } label: { Text("Do something else") } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to AI
Depends what you mean. But a lot of advanced functions that require intensive on board processing will only be available on 15 Pro and above…
Replies
Boosts
Views
Activity
Jun ’24
Reply to Closure | Error when referring static variable
You can refer to a static variable. As shown in the small code below: struct Preview: View { private static let NAME = "Test" var array: [String] = ["someTest", "Hello", "HelloTest"] var filtered: [String] { array.filter { $0.contains(Preview.NAME) } } var body: some View { ForEach(filtered, id: \.self) { s in Text(s) } } } So the problem is the use in the Query. May be you could try to include in a computed var ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Share settings from SwiftUI in-app settings view to other views
There are several options: use environment var, in a class that groups all the settings AppStorage may be a good option. However, if you have a lot of var, that becomes tedious. How many var have you, of which type ? An idea here is to multiplex the var. imagine you have 8 Int var, which value is in fact between 0 and 255. Then you can create a function to multiplex them: var1 + 256*var2 * 256*256*var3 etc and a demux function, using a succession of % and DIV to get each var back The best would be you show some code so that we can be more specific.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to "Sensitive language" errors
Have a look here: https://forums.developer.apple.com/forums/thread/747146 and here: https://developer.apple.com/forums/thread/746365 Sensitive may be information like your Apple ID or other confidential information. Or some parts are identified as referring for instance to some country code where the robot is suspicious…
Replies
Boosts
Views
Activity
Jun ’24
Reply to [iPadOS 18] Make Tabbar back to previous version
Hate is usually a bad adviser… 😇 So you'd better file a bug report, as done here: https://developer.apple.com/forums/thread/756652 But it is likely a definite design choice to save space on iPad (not possible on iPhone probably because of Dynamic Island) and progressively all apps will adopt, so it is probably better to get accustomed to it…
Topic: UI Frameworks SubTopic: UIKit
Replies
Boosts
Views
Activity
Jun ’24
Reply to Handling of dates with no value when creating a date bar chart in Charts
All data are shown… but you have to scroll. Add .chartXVisibleDomain to change the scale and see the full range Chart(sessions, id: \.date) { session in BarMark( x: .value("Date", session.date), y: .value("Max RM", session.maxRM) ) } .chartXAxis { AxisMarks(values: .stride(by: .day, count:7)) // 日付の表示間隔を調整 } .chartXVisibleDomain(length: 3600 * 24 * 30) // 30 days in this case .chartScrollableAxes(.horizontal) // 横スクロールを有効にする .padding([.leading, .trailing, .bottom]) Note: totalVolume is shown but as it is zero is a zero height bar.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’24