Post

Replies

Boosts

Views

Activity

Reply to TableView Returns Nil - Trying to Update UI in another class.
When posting code, you should use code formatter to make it readable: I have a a static object in HomeVC: static data: MyType = [] { ... didSet { let storyboard = UIStoryboard(name: "Main", bundle: nil) let logsVC = storyboard.instantiateViewController(identifier: "LogsView") as? LogsViewController logsVC?.updateUI(with: HomeViewController.data) } } And a func to update tableview in DetailVC: func updateUI(with data: [MyType]) { self.tableView.reloadData() // this gives nil error on runtime. } What is nil ? tableView ? you call updateUI on a LogsViewController, but you say it is defined in DetailVC ?!?! where is tableView ? In HomeVC ? In LogsViewController ? In DetailVC ? You create a new instance of LogsViewController VC each time you update. Why ? could you post more code so that we can understand better.
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’21
Reply to Delete Cells From A Set
The problem is you declare only a get for favSet in the computed var    var favSet: OrderedSet<CurrentPlayers> {     FavouriteManager.shared.favSet   } Declare get and set and that will work. Why don't you use an Array and manage to eliminate duplicate entries in the array ?when you append to it (just test if the new entry is already inside).
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Reply to Delete Cells From A Set
What is the tableView dataSource ? It must be updated before deleteRow. If the dataSource is FavouriteManager.shared.favSet, you must update it as well:     if editingStyle == .delete {       tableView.beginUpdates()       favSet.remove(at: favSet.index(favSet.startIndex, offsetBy: indexPath.row)) FavouriteManager.shared.favSet = favSet // I do not know how you defined, can't be sure it will work       tableView.deleteRows(at: [indexPath], with: .fade)       tableView.endUpdates()     } Please show all delegate func for the tableView, in particular cellForRow
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Reply to Delete Cells From A Set
So your dataSource is favSet. But you get it from the shared. I would try: var favSet: OrderedSet<CurrentPlayers> {     get { FavouriteManager.shared.favSet } set { FavouriteManager.shared.favSet = newValue }   } and revert to the .delete:   if editingStyle == .delete {       tableView.beginUpdates()       favSet.remove(at: favSet.index(favSet.startIndex, offsetBy: indexPath.row))       tableView.deleteRows(at: [indexPath], with: .fade)       tableView.endUpdates()     }
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’21
Reply to DateComponents configuration for x months
I see the documentation says DateComponents.month = a month or count of months.  Where exactly did you read this ? You may misinterpret it. AFAIU, this means that month may be the month value or a number of months to add to a date Day, week, weekday, month, and year numbers are generally 1-based, but there may be calendar-specific exceptions. Ordinal numbers, where they occur, are 1-based. Some calendars may have to map their basic unit concepts into the year/month/week/day/… nomenclature. The particular values of the unit are defined by each calendar and are not necessarily consistent with values for that unit in another calendar. Listing 4 shows how you can create a date components object that you can use to create the date where the year unit is 2004, the month unit is 5, and the day unit is 6 (in the Gregorian calendar this is May 6th, 2004). You can also use it to add 2004 year units, 5 month units, and 6 day units to an existing date. The value of weekday is undefined since it is not otherwise specified. https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/DatesAndTimes/Articles/dtCalendars.html#//apple_ref/doc/uid/TP40003470 What is needed to achieve my goal of repeating every x months? I would try to skip the month: var dateComponents = DateComponents() dateComponents.calendar = Calendar.current // REMOVE THIS dateComponents.month = 1 dateComponents.day = 1 dateComponents.hour = 7
Aug ’21
Reply to Prevent Text Field from containing 2 decimal points in Swift
Declare that the class conforms to UITextFieldDelegate Use the func:      func textFieldDidChangeSelection(_ textField: UITextField) { } to test there are not 2 decimal points (and maybe test that you only have digits ?) Code should be like this (I assume there is only one textField in your view, otherwise you have to test that textField is the correct one): func textFieldDidChangeSelection(_ textField: UITextField) { if let typedText = textField.text { // What have we typed in ? var dotCount = 0 for c in typedText { // count dot or comma if String(c) == "." || String(c) == "," {  dotCount += 1  } } if dotCount >= 2 { // remove last typed                     textField.text = String(typedText.dropLast()) } } }
Topic: UI Frameworks SubTopic: UIKit Tags:
Aug ’21
Reply to code sign failed with non zero exit code
You have to Answer the question (not comment) to attach an image. In the original post, we see you have a warning to Update project settings. Did you do it ? Did you have a look at this ? https://developer.apple.com/forums/thread/123658
Replies
Boosts
Views
Activity
Aug ’21
Reply to TableView Returns Nil - Trying to Update UI in another class.
When posting code, you should use code formatter to make it readable: I have a a static object in HomeVC: static data: MyType = [] { ... didSet { let storyboard = UIStoryboard(name: "Main", bundle: nil) let logsVC = storyboard.instantiateViewController(identifier: "LogsView") as? LogsViewController logsVC?.updateUI(with: HomeViewController.data) } } And a func to update tableview in DetailVC: func updateUI(with data: [MyType]) { self.tableView.reloadData() // this gives nil error on runtime. } What is nil ? tableView ? you call updateUI on a LogsViewController, but you say it is defined in DetailVC ?!?! where is tableView ? In HomeVC ? In LogsViewController ? In DetailVC ? You create a new instance of LogsViewController VC each time you update. Why ? could you post more code so that we can understand better.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to "Xcode cannot be installed because Mac OS 10.11 or later is required" but I am already on 10.12
Did you try to reboot the Mac ? If not enough, try to download from here: h t t p s : / / xcodereleases.com
Replies
Boosts
Views
Activity
Aug ’21
Reply to Delete Cells From A Set
The problem is you declare only a get for favSet in the computed var    var favSet: OrderedSet<CurrentPlayers> {     FavouriteManager.shared.favSet   } Declare get and set and that will work. Why don't you use an Array and manage to eliminate duplicate entries in the array ?when you append to it (just test if the new entry is already inside).
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Delete Cells From A Set
you could just add a setter var favSet: OrderedSet<CurrentPlayers> {     get { FavouriteManager.shared.favSet } set { print("New value", newValue) } // print just to see ; could be no statement   }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Delete Cells From A Set
What is the tableView dataSource ? It must be updated before deleteRow. If the dataSource is FavouriteManager.shared.favSet, you must update it as well:     if editingStyle == .delete {       tableView.beginUpdates()       favSet.remove(at: favSet.index(favSet.startIndex, offsetBy: indexPath.row)) FavouriteManager.shared.favSet = favSet // I do not know how you defined, can't be sure it will work       tableView.deleteRows(at: [indexPath], with: .fade)       tableView.endUpdates()     } Please show all delegate func for the tableView, in particular cellForRow
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Delete Cells From A Set
So your dataSource is favSet. But you get it from the shared. I would try: var favSet: OrderedSet<CurrentPlayers> {     get { FavouriteManager.shared.favSet } set { FavouriteManager.shared.favSet = newValue }   } and revert to the .delete:   if editingStyle == .delete {       tableView.beginUpdates()       favSet.remove(at: favSet.index(favSet.startIndex, offsetBy: indexPath.row))       tableView.deleteRows(at: [indexPath], with: .fade)       tableView.endUpdates()     }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to DateComponents configuration for x months
I see the documentation says DateComponents.month = a month or count of months.  Where exactly did you read this ? You may misinterpret it. AFAIU, this means that month may be the month value or a number of months to add to a date Day, week, weekday, month, and year numbers are generally 1-based, but there may be calendar-specific exceptions. Ordinal numbers, where they occur, are 1-based. Some calendars may have to map their basic unit concepts into the year/month/week/day/… nomenclature. The particular values of the unit are defined by each calendar and are not necessarily consistent with values for that unit in another calendar. Listing 4 shows how you can create a date components object that you can use to create the date where the year unit is 2004, the month unit is 5, and the day unit is 6 (in the Gregorian calendar this is May 6th, 2004). You can also use it to add 2004 year units, 5 month units, and 6 day units to an existing date. The value of weekday is undefined since it is not otherwise specified. https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/DatesAndTimes/Articles/dtCalendars.html#//apple_ref/doc/uid/TP40003470 What is needed to achieve my goal of repeating every x months? I would try to skip the month: var dateComponents = DateComponents() dateComponents.calendar = Calendar.current // REMOVE THIS dateComponents.month = 1 dateComponents.day = 1 dateComponents.hour = 7
Replies
Boosts
Views
Activity
Aug ’21
Reply to How to connect Apple Music Api Flutter
@princedhameliya Why don't you ask directly to Flutter or look on their forum ?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Who's on top? Swift, nonSwiftUI
Do you create views in Interface Builder ? If so, the view on top must be after in the list of views (as for Red View On Top, after Green View Below in list): You get:
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Guideline 1.4.1 - Safety - Physical Harm
My reading of the guidelines is that for medical app, the source must be approved by an official source, such as Ministry of health, W.H.O, …
Replies
Boosts
Views
Activity
Aug ’21
Reply to Prevent Text Field from containing 2 decimal points in Swift
Declare that the class conforms to UITextFieldDelegate Use the func:      func textFieldDidChangeSelection(_ textField: UITextField) { } to test there are not 2 decimal points (and maybe test that you only have digits ?) Code should be like this (I assume there is only one textField in your view, otherwise you have to test that textField is the correct one): func textFieldDidChangeSelection(_ textField: UITextField) { if let typedText = textField.text { // What have we typed in ? var dotCount = 0 for c in typedText { // count dot or comma if String(c) == "." || String(c) == "," {  dotCount += 1  } } if dotCount >= 2 { // remove last typed                     textField.text = String(typedText.dropLast()) } } }
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Adding Restores Everything
You should show how you handle the passFavNotification (I mean, where do you call handleFavNotification)
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Complete Unresponsive Iphone 11
Have you tried to reboot it ?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’21
Reply to Complete Unresponsive Iphone 11
@Roy_Good from what  shaikhalid posted, seems he/she has tried most of what is described here. Did you too? https://support.apple.com/en-us/HT201412
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’21