Post

Replies

Boosts

Views

Activity

Reply to Segmentation fault vs Variable ... used before being initialized
init() in SwiftUI for State var is a bit tricky: https://www.hackingwithswift.com/forums/swiftui/why-no-setting-of-intial-state/2021 Something like this should work:     @Binding var playingId: Int?     @State var player: AVPlayer!     init(playingId: Binding<Int?>, player: AVPlayer) {         _player = State(initialValue: player)         self._playingId = playingId }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’21
Reply to Is it legal to decompile Apple Open Source components?
If you illustrate behaviour by showing interactions, you do not decompile, you simply execute. So there should not be decompilation legal issue. Take care to fully follow open software rules (you may have to publish the relevant parts of your code in open source). I would also advise to be very clear when you submit to Appstore, by explaining the situation in the comments to reviewer.
Topic: App & System Services SubTopic: Core OS Tags:
Aug ’21
Reply to Bug in SwiftUI?
There may be an identifier missing . Replace List(m_watch_list_view_model.m_watch_list_model) { watch_list_model in with List(m_watch_list_view_model.m_watch_list_model, id: \.id) { watch_list_model in Note: the use of underscore in name is not Switish at all. Remove them and replace by camelCase. For instance m_watch_list_view_model should become mWatchListViewModel furthermore, the starting m has not clear meaning.  So you could replace with watchListViewModel
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’21
Reply to Is there a way to generate Swift/Swift UI code based on user input?
No direct answer to the question. But take care on rules for review: there are strict limits to adding executable code to an app. 2.5.2 Apps should be self-contained in their bundles, and may not read or write data outside the designated container area, nor may they download, install, or execute code which introduces or changes features or functionality of the app, including other apps. Educational apps designed to teach, develop, or allow students to test executable code may, in limited circumstances, download code provided that such code is not used for other purposes. Such apps must make the source code provided by the app completely viewable and editable by the user.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’21
Reply to How to extract the value of CGFloat from CGPoint?
1.       var xvalues: [CGFloat] = [] 2.       var yvalues: [CGFloat] = [] 3.       if (observation1.count) == 5{ 4.         for n in observation1 { 5.           xvalues.append(n.x) 6.           yvalues.append(n.y) 7.         } 8.         filter1 = convolve(xvalues, sgfilterwindow5_order2) 9.         filter2 = convolve(yvalues, sgfilterwindow5_order2) It seems you miss a closing curly bracket before line 8. Use map function: if (observation1.count) == 5 { xvalues = observation1.map {$0.x } yvalues = observation1.map {$0.y } }
Aug ’21
Reply to Xcode 13 beta has issues during build storyboards
Are you using third party frameworks ? With which version of Xcode was the project created ? Have you looked at the issues Navigator (left pane in Xcode) to see if you have warnings to update to new settings ? If so, update, then clean build folder and restart Xcode. Try again to build again. If you still have the problem, create a phony new project, and try to build. What do you get ?
Aug ’21
Reply to Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
When you post code, please format code in a more readable way and use code formatter, such as: struct NavigationIndicator: UIViewControllerRepresentable { typealias UIViewControllerType = ARVieww func makeUIViewController(context: Context) -> ARVieww { return ARVieww() } func updateUIViewController(_ uiViewController: NavigationIndicator.UIViewControllerType, context: UIViewControllerRepresentableContext) { } } Where exactly do you get the crash ?
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Reply to MacOS Development Reference
I am confused on which path to head down : SwiftUI or Appkit. I (personal opinion) recommend to stay with Appkit. Because of maturity of SwiftUI and because it introduces another layer that make things even more complex. Here a a good tutorial series to start: h t t p s : / / w w w .raywenderlich.com/731-macos-development-for-beginners-part-1 h t t p s : / / w w w .raywenderlich.com/730-macos-development-for-beginners-part-2 h t t p s : / / w w w .raywenderlich.com/729-macos-development-for-beginners-part-3 And this, it's an old document (2013) but very detailed: https://developer.apple.com/library/archive/referencelibrary/GettingStarted/RoadMapOSX/chapters/01_Introduction.html
Topic: UI Frameworks SubTopic: AppKit Tags:
Aug ’21
Reply to Segmentation fault vs Variable ... used before being initialized
init() in SwiftUI for State var is a bit tricky: https://www.hackingwithswift.com/forums/swiftui/why-no-setting-of-intial-state/2021 Something like this should work:     @Binding var playingId: Int?     @State var player: AVPlayer!     init(playingId: Binding<Int?>, player: AVPlayer) {         _player = State(initialValue: player)         self._playingId = playingId }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Is it legal to decompile Apple Open Source components?
If you illustrate behaviour by showing interactions, you do not decompile, you simply execute. So there should not be decompilation legal issue. Take care to fully follow open software rules (you may have to publish the relevant parts of your code in open source). I would also advise to be very clear when you submit to Appstore, by explaining the situation in the comments to reviewer.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Bug in SwiftUI?
There may be an identifier missing . Replace List(m_watch_list_view_model.m_watch_list_model) { watch_list_model in with List(m_watch_list_view_model.m_watch_list_model, id: \.id) { watch_list_model in Note: the use of underscore in name is not Switish at all. Remove them and replace by camelCase. For instance m_watch_list_view_model should become mWatchListViewModel furthermore, the starting m has not clear meaning.  So you could replace with watchListViewModel
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Started to learn Swift and got stuck...
Thanks for the feedback. Don’t forget to close your thread.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Is there a way to generate Swift/Swift UI code based on user input?
No direct answer to the question. But take care on rules for review: there are strict limits to adding executable code to an app. 2.5.2 Apps should be self-contained in their bundles, and may not read or write data outside the designated container area, nor may they download, install, or execute code which introduces or changes features or functionality of the app, including other apps. Educational apps designed to teach, develop, or allow students to test executable code may, in limited circumstances, download code provided that such code is not used for other purposes. Such apps must make the source code provided by the app completely viewable and editable by the user.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to How to extract the value of CGFloat from CGPoint?
1.       var xvalues: [CGFloat] = [] 2.       var yvalues: [CGFloat] = [] 3.       if (observation1.count) == 5{ 4.         for n in observation1 { 5.           xvalues.append(n.x) 6.           yvalues.append(n.y) 7.         } 8.         filter1 = convolve(xvalues, sgfilterwindow5_order2) 9.         filter2 = convolve(yvalues, sgfilterwindow5_order2) It seems you miss a closing curly bracket before line 8. Use map function: if (observation1.count) == 5 { xvalues = observation1.map {$0.x } yvalues = observation1.map {$0.y } }
Replies
Boosts
Views
Activity
Aug ’21
Reply to Outlet error
@szymczyk plus If it still doesn't work, do a clean build folder and possibly restart Xcode.
Replies
Boosts
Views
Activity
Aug ’21
Reply to Inline or compact UIDatePicker with white tint color
Could you check what you get for the 11 label if you select Aug 12 ?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Inline or compact UIDatePicker with white tint color
Here is what I get with a default (blue) background: Problem is that today is now blu, not white. But could not find a way to change the color in selection.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Xcode 13 beta has issues during build storyboards
Are you using third party frameworks ? With which version of Xcode was the project created ? Have you looked at the issues Navigator (left pane in Xcode) to see if you have warnings to update to new settings ? If so, update, then clean build folder and restart Xcode. Try again to build again. If you still have the problem, create a phony new project, and try to build. What do you get ?
Replies
Boosts
Views
Activity
Aug ’21
Reply to Xcode 13 beta has issues during build storyboards
I have the same error in a new project Is it a Swift/UIKit project (not SwiftUI) ? Is it a new project without framework, just create and run ? If so, problem likely comes from your config. May try to load XCode13ß5, just available.
Replies
Boosts
Views
Activity
Aug ’21
Reply to Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
When you post code, please format code in a more readable way and use code formatter, such as: struct NavigationIndicator: UIViewControllerRepresentable { typealias UIViewControllerType = ARVieww func makeUIViewController(context: Context) -> ARVieww { return ARVieww() } func updateUIViewController(_ uiViewController: NavigationIndicator.UIViewControllerType, context: UIViewControllerRepresentableContext) { } } Where exactly do you get the crash ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Why am I getting touchesCanceled instead of touchesEnded?
Yes, it may be a question of how fast you lift the finger. See discussion here: https://stackoverflow.com/questions/10325776/touchescancelled-is-called-instead-of-touchesended The best is probably to call the same code for touchesEnded and touchesCancelled.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to MacOS Development Reference
I am confused on which path to head down : SwiftUI or Appkit. I (personal opinion) recommend to stay with Appkit. Because of maturity of SwiftUI and because it introduces another layer that make things even more complex. Here a a good tutorial series to start: h t t p s : / / w w w .raywenderlich.com/731-macos-development-for-beginners-part-1 h t t p s : / / w w w .raywenderlich.com/730-macos-development-for-beginners-part-2 h t t p s : / / w w w .raywenderlich.com/729-macos-development-for-beginners-part-3 And this, it's an old document (2013) but very detailed: https://developer.apple.com/library/archive/referencelibrary/GettingStarted/RoadMapOSX/chapters/01_Introduction.html
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Break on @main with out any break points set.
That's not where the error is. It is just the place where debugger returns after crash. You have to find where is the crash, for instance by adding some print statements at the place of last action before crash.
Replies
Boosts
Views
Activity
Aug ’21