Post

Replies

Boosts

Views

Activity

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
Could you try to remove updateSuggestionMenu() showSuggestionMenu() override func textDidChange(_ notification: Notification) { super.textDidChange(notification) print("Still typing") // updateSuggestionMenu() // showSuggestionMenu() } If the problem disappear, you should reset focus after updateSuggestionMenu() showSuggestionMenu()
Topic: UI Frameworks SubTopic: AppKit Tags:
Jun ’24
Reply to loaded array from plist. call using AppDelegate() returns empty array.
Could you show your complete AppDelegate code ? There is probably a problem here: let typesArray = AppDelegate().typesArray you create a new instance of AppDelegate (as AppDelegate() is a call to init to create a new instance), which itself has an empty typesArray as long as loadTypesArray has not been called. Hence let typesArray = returns empty array. If typesArray is declared as static in AppDelegate, then you can call in loadTypesArray: AppDelegate.typesArray = plist // Need to refer to class because of static Elsewhere: let typesArray = AppDelegate.typesArray // No ()
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’24
Reply to Creating a navigation link within a chart?
I have not tried it, so I can't say if it works in your case. You could try to use chartOverlay as described in doc, and use it to get in a State var where you tapped and then move to the view according to this known tap point.: Chart(data) { LineMark( x: .value("date", $0.date), y: .value("price", $0.price) ) } .chartOverlay { proxy in GeometryReader { geometry in Rectangle().fill(.clear).contentShape(Rectangle()) .gesture( DragGesture() .onChanged { value in // Convert the gesture location to the coordinate space of the plot area. let origin = geometry[proxy.plotAreaFrame].origin let location = CGPoint( x: value.location.x - origin.x, y: value.location.y - origin.y ) // Get the x (date) and y (price) value from the location. let (date, price) = proxy.value(at: location, as: (Date, Double).self) print("Location: \(date), \(price)") } ) } } Another tutorial here: https://swiftwithmajid.com/2023/02/06/mastering-charts-in-swiftui-interactions/ Hope that can help.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’24
Reply to How to take back the control of our application ?
You need to receive the complete folder that contains Xcode project, not only the source files (otherwise, you'll have a significant work to rebuild the project). The process should be: unzip the zip file (just double click on the icon) check that you get a folder containing a file such as MyProject.xcodeproj and a folder named MyProject (of course, you'll a name different than MyProject in both) have xCode installed on your Mac then double clicking on MyProject.xcodeproj will open the project in Xcode. From there you can start modifying code and generate new spa file.
Jun ’24