Post

Replies

Boosts

Views

Activity

Reply to SwiftUI Date Picker is Problematic
I think it is linked to the locale. Did you try to set locale (see https://stackoverflow.com/questions/58610557/swiftui-datepicker-displaying-language-in-english-only): DatePicker(…) .environment(\.locale, Locale.init(identifier: "us")). // Or the locale you want Have a look at the solution presented here : https://stackoverflow.com/questions/59051670/change-selected-date-format-from-datepicker-swiftui
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to How to readd a notification observer
Where do you reset removeOberver to false ? Are you sure this is even executed ? Add a log: if removeOberver == false { print("Re-add notification") NotificationCenter.default.addObserver( self, selector: #selector(Myclass.deviceTapped), name: Notification.Name("bluetoothRecievedNoticicationName"), object: nil) } Note: may be there is a typo in bluetoothRecievedNoticicationName (bluetoothRecievedNotificationName) It is in fact a better practice to define name in extension: extension Notification.Name {      public static let kBTReceiveNotification = Notification.Name("bluetoothRecievedNotificationName") }
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21
Reply to Best practice for storing repeating dates in CoreData
Another way to do it. Instead of storing a full list of dates, you could also only store the start and endDate and the repeat factor. That would be a more compressed form. And decompress in an array of dates (as in the code above) when you need to use. Instead of saving the array, you would save a struct containing startDate endDate repeats Have a look here on how to code this: https://stackoverflow.com/questions/37876275/how-do-i-store-a-swift-struct-in-core-data-on-ios
Topic: App & System Services SubTopic: General Tags:
Mar ’21
Reply to Guideline for developing 3D simulation software
That is an ambitious project if you are a beginner. Do you master Swift, Mac API ? I would recommend not to try to do it in SwiftUI. I personally think it is not mature enough for such development. Have a look at SceneKit https://developer.apple.com/scenekit/ and RealityKit https://developer.apple.com/documentation/realitykit/creating_3d_content_with_reality_composer This tutorial may be worth reading as well (even though for iOS): https ://www.raywenderlich. com/376-3d-apple-games-by-tutorials-updated-for-swift-4-and-ios-11
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to TableView relsoaddata from textField on the same viewController with TableView
Please better format the code you post: override func viewDidAppear( animated: Bool) { super.viewDidAppear(animated) loadData() // this is my function that queries and reloads data } I have also a textField from which a message is captured updates the database and calls loadData() as follows: @IBAction func composeButton( sender: Any) { //inputAlert() if (feedInputField.text != "" ) { let reqType = Int(reqTypeIndex.text ?? "") ?? 0 AddFeedbacks(message: feedInputField.text ?? "", taskId: idTask?.text ?? "", atype: reqType) loadData() feedInputField.text = "" } } func r_feedback(rtaskId: String) { var singleFeed = myFeedback() self.arrayOfFeedback.removeAll() queryFeedback(taskId: rtaskId).findObjectsInBackground { (objects, error) in if let objects = objects { if (objects.count 0) { for eachFeed in objects { singleFeed.feedDate = eachFeed.createdAt! singleFeed.userNameFrom = eachFeed["UserNameFrom"] as? String singleFeed.feedMessage = eachFeed["TaskFeedback"] as? String singleFeed.atype = eachFeed["AType"] as? Int self.arrayOfFeedback.append(singleFeed) } } else { singleFeed.feedDate = nil singleFeed.userNameFrom = "" singleFeed.feedMessage = "" singleFeed.atype = nil } self.fTableView.reloadData() } } } What is AddFeedbacks ? Note: name should start with lowerCase. Problem : When the app first loads, it loads existing messages in the database. And if I add a new message from the feedInputField, the tableView is not updated but if I added a second message, it then displays both messages. From there, it starts updating normaly. The issue is only when i load the app and after that it works. Problem could be that addFeedbacks executes in another thread asynchronously. And completes after you reload.
Topic: App & System Services SubTopic: Core OS Tags:
Mar ’21
Reply to Need notification in code, if user change View
What you should do, in the VC : Declare at class level:     var synthesizer : AVSpeechSynthesizer? Everywhere you need to speak, you set the var : // Avoid superposition of speakers if synthesizer != nil { synthesizer!.stopSpeaking(at: .immediate) synthesizer = nil } let newSynthe = whatToSpeak.speakIt() synthesizer = newSynthe And close when disappear: override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) if synthesizer != nil { synthesizer!.stopSpeaking(at: .immediate) synthesizer = nil } } Used, works well.
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21
Reply to Picker with SegmentedPickerStyle and Image
Well, you did not say what the exact problem was. I thought you did not see the image, in fact it is not displayed properly. In fact it appears that scaleToFit does nothing ! https://stackoverflow.com/questions/59635519/swiftui-picker-segmentedstyle-image-bad-display Should file a bug report. Note: that is the same problem than in UIKit TabBar icons. You have to manually size the image before using. Thanks to note the FB reference if you file a bug report. And don't forget to close the thread.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to Closure definition mismatch
See this: https://developer.apple.com/app-store/submissions/  https://developer.apple.com/ios/submit/ says: Starting April, 2020, all apps submitted to the App Store will need to be built with Xcode 11. Xcode 11 requires macOS Mojave 10.14.3 or later. Starting April 2021, all iOS and iPadOS apps submitted to the App Store must be built with Xcode 12 and the iOS 14 SDK. And more here: https://stackoverflow.com/questions/41891165/minimum-xcode-version-to-upload-to-app-store
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21