Post

Replies

Boosts

Views

Activity

Reply to Finding time till battery will fully charged
Depends how accurate you want. I would look for several ways: observe on different devices the charging profile (charge vs time), from 5% to 95% (this may depend on the charger) use this abacus to estimate time to charge when you get the initial battery level (SoC) Problem: you need to get such a profile for all types of devices and that will change with battery ageing. In addition, iOS may modify charging power depending on conditions (like temperature or also its learning of charging habits). see such a curve example here (in french, but chart is OK): h t t p s : / / w w w.it-swarm-fr.com/fr/iphone/comment-obtenir-le-niveau-de-batterie-en-temps-reel-sur-ios-avec-une-granularite-de-1/1068029999/ Full charge requires about 100 minutes, which means 1% / minute. If you measure at 5' interval, don't you get enough accuracy ?
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’21
Reply to Where do you select the UIKit in Xcode
Where do you configure the project to point to the correct UIKit. If I understand correctly your question, you cannot. That's depending on Xcode version and the iOS SDK that goes with it. Note: using an older Xcode could temporarily solve the problem. But that would forbid you to publish on the AppStore. So that's not a solution. . UITableViewRowAnimation has been renamed to UITableView.RowAnimation You have to go through and accept the changes, even if there are hundreds of them (but you will do it only once to update to more recent Xcode). . I have noticed two versions of the UI No, that's the same "version", but one for Swift and the other for objC.
Dec ’21
Reply to Where's my code?
I built a screen with two buttons in Swift. Do you mean you created 2 buttons in the storyboard ? . But where is the source code? To start with, you will not see any code when you create buttons (or objects) in Interface builder. What you do next usually: display the code of the view controller and the storyboard control drag from the button to the code to create an IBAction you will write the code to execute when tapping the button here if you need to access the button itself, control drag again to create an IBOutlet Note: you should study "Intro to App development with Swift" in Apple Books to learn the basics.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’21
Reply to Need help understanding this syntax
But am unsure what  (_) in is. _ means that the var name is hidden. . Let's explain: you could write fully expanded syntax: controller.addAction(UIAlertAction(title: "OK", style: .default, handler: { (action) -> Void  in controller.dismiss(animated: true, completion: nil)})) This would give you a reference to the action: UIAlertAction parameter . You can also skip -> Void (as you do when you declare a func without return value): controller.addAction(UIAlertAction(title: "OK", style: .default, handler: { (action)  in controller.dismiss(animated: true, completion: nil)})) And finally, if you don't need access to action, you can replace with _ controller.addAction(UIAlertAction(title: "OK", style: .default, handler: { (_)  in controller.dismiss(animated: true, completion: nil)})) Going even further, you can remove the parenthesis: controller.addAction(UIAlertAction(title: "OK", style: .default, handler: { _  in controller.dismiss(animated: true, completion: nil)})) . I have also sometimes seen it as [self] in This "captures" self and avoid you to have to write self.someProperty each time you need to access inside the closure to someProperty or func defined of the class (self).
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’21
Reply to How can I remove duplicates from a Picker
This should not compile, as you forgot Dragon(s) You can compute the unique labels: enum Race: String, CaseIterable { case Ainur, Balrog, Dragon, Dragons, Dwarf, Dwarves, Eagle, Eagles var description: String { switch self { case .Ainur: return "Ainur" case .Balrog: return "Balrog" case .Dwarf, .Dwarves: return "Dwarf" case .Eagle, .Eagles: return "Eagles" case .Dragon, .Dragons: // NEED this case return "Dragons" } } static var uniqueDescriptions : [String] { var currentDescriptions : [String] = [] for race in Race.allCases { if !currentDescriptions.contains(race.description) { currentDescriptions.append(race.description) } } return currentDescriptions } } print(Race.uniqueDescriptions) Gives ["Ainur", "Balrog", "Dragons", "Dwarf", "Eagles"] So Picker code:              Picker("Filter by Race", selection: $raceSelection) {                               ForEach (Race.uniqueDescriptions, id: \.self, content: { race in                                   Text(race.description)                   .tag(race.description)               })             }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’21
Reply to clock
Could you explain more clearly what you want ? What do you mean by clock out? What have you tried so far ? What do you get ? What did you expect ? Please don't forget to feedback when you get answers to your posts. And either explain remaining problem or close the thread on the correct answer. That helps keep the forum clean and is fair to those who answered.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’21
Reply to I can't access my apps
Appstore Connect may be whimsical some times. For instance, Trends do not show anything, until i go to another tab, refresh a page and return to AppStore Connect tab. Is it a browser issue (problem may show on Safari Technology preview but not on Safari) or server issue, hard to say. Quit Safari and reopen may help.
Dec ’21
Reply to How do I write code to run when the contact store was changed by another app, but not run when the contact store was changed by my app?
May be I miss something. Why not have a global Bool var in your app that will be true when you change contact store ? And use it to decide action on contacts change. And reset this var to false once you have done the action for app based changes.
Replies
Boosts
Views
Activity
Dec ’21
Reply to Get battery health
Accessible information has been limited since iOS 10. Could this provide some help ? https://stackoverflow.com/questions/36024247/getting-battery-health-information-on-ios
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to Finding time till battery will fully charged
Depends how accurate you want. I would look for several ways: observe on different devices the charging profile (charge vs time), from 5% to 95% (this may depend on the charger) use this abacus to estimate time to charge when you get the initial battery level (SoC) Problem: you need to get such a profile for all types of devices and that will change with battery ageing. In addition, iOS may modify charging power depending on conditions (like temperature or also its learning of charging habits). see such a curve example here (in french, but chart is OK): h t t p s : / / w w w.it-swarm-fr.com/fr/iphone/comment-obtenir-le-niveau-de-batterie-en-temps-reel-sur-ios-avec-une-granularite-de-1/1068029999/ Full charge requires about 100 minutes, which means 1% / minute. If you measure at 5' interval, don't you get enough accuracy ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to Where do you select the UIKit in Xcode
Where do you configure the project to point to the correct UIKit. If I understand correctly your question, you cannot. That's depending on Xcode version and the iOS SDK that goes with it. Note: using an older Xcode could temporarily solve the problem. But that would forbid you to publish on the AppStore. So that's not a solution. . UITableViewRowAnimation has been renamed to UITableView.RowAnimation You have to go through and accept the changes, even if there are hundreds of them (but you will do it only once to update to more recent Xcode). . I have noticed two versions of the UI No, that's the same "version", but one for Swift and the other for objC.
Replies
Boosts
Views
Activity
Dec ’21
Reply to EV3 Compatability
Did you search in Apple Books ?
Replies
Boosts
Views
Activity
Dec ’21
Reply to Where's my code?
I built a screen with two buttons in Swift. Do you mean you created 2 buttons in the storyboard ? . But where is the source code? To start with, you will not see any code when you create buttons (or objects) in Interface builder. What you do next usually: display the code of the view controller and the storyboard control drag from the button to the code to create an IBAction you will write the code to execute when tapping the button here if you need to access the button itself, control drag again to create an IBOutlet Note: you should study "Intro to App development with Swift" in Apple Books to learn the basics.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to Need help understanding this syntax
But am unsure what  (_) in is. _ means that the var name is hidden. . Let's explain: you could write fully expanded syntax: controller.addAction(UIAlertAction(title: "OK", style: .default, handler: { (action) -> Void  in controller.dismiss(animated: true, completion: nil)})) This would give you a reference to the action: UIAlertAction parameter . You can also skip -> Void (as you do when you declare a func without return value): controller.addAction(UIAlertAction(title: "OK", style: .default, handler: { (action)  in controller.dismiss(animated: true, completion: nil)})) And finally, if you don't need access to action, you can replace with _ controller.addAction(UIAlertAction(title: "OK", style: .default, handler: { (_)  in controller.dismiss(animated: true, completion: nil)})) Going even further, you can remove the parenthesis: controller.addAction(UIAlertAction(title: "OK", style: .default, handler: { _  in controller.dismiss(animated: true, completion: nil)})) . I have also sometimes seen it as [self] in This "captures" self and avoid you to have to write self.someProperty each time you need to access inside the closure to someProperty or func defined of the class (self).
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to How can I remove duplicates from a Picker
This should not compile, as you forgot Dragon(s) You can compute the unique labels: enum Race: String, CaseIterable { case Ainur, Balrog, Dragon, Dragons, Dwarf, Dwarves, Eagle, Eagles var description: String { switch self { case .Ainur: return "Ainur" case .Balrog: return "Balrog" case .Dwarf, .Dwarves: return "Dwarf" case .Eagle, .Eagles: return "Eagles" case .Dragon, .Dragons: // NEED this case return "Dragons" } } static var uniqueDescriptions : [String] { var currentDescriptions : [String] = [] for race in Race.allCases { if !currentDescriptions.contains(race.description) { currentDescriptions.append(race.description) } } return currentDescriptions } } print(Race.uniqueDescriptions) Gives ["Ainur", "Balrog", "Dragons", "Dwarf", "Eagles"] So Picker code:              Picker("Filter by Race", selection: $raceSelection) {                               ForEach (Race.uniqueDescriptions, id: \.self, content: { race in                                   Text(race.description)                   .tag(race.description)               })             }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to clock
Could you explain more clearly what you want ? What do you mean by clock out? What have you tried so far ? What do you get ? What did you expect ? Please don't forget to feedback when you get answers to your posts. And either explain remaining problem or close the thread on the correct answer. That helps keep the forum clean and is fair to those who answered.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to iOS Contacts Framework Change History Data using Swift and Xcode 13
There is a similar question on SO, with a different signature. Is it the same ? Did you ask the question to Apple Support ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to CLLocationButton not work for Chinese Simplified localization.
Could you explain precisely what does not work ? And show code so that someone can test it ?
Replies
Boosts
Views
Activity
Dec ’21
Reply to What is necessary to use the microphone in OSX notarized app?
Info.plist which contains the NSMicrophoneUsageDescription pair  Do you mean the key and the description string (must not be empty) ?
Topic: Code Signing SubTopic: Entitlements Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to I can't access my apps
Appstore Connect may be whimsical some times. For instance, Trends do not show anything, until i go to another tab, refresh a page and return to AppStore Connect tab. Is it a browser issue (problem may show on Safari Technology preview but not on Safari) or server issue, hard to say. Quit Safari and reopen may help.
Replies
Boosts
Views
Activity
Dec ’21
Reply to testflight
I need an invitation code for testflight That doesn't exist. There is no code for testFlight, but code for an app on TestFlight. So better follow robnotyou advice.
Replies
Boosts
Views
Activity
Dec ’21
Reply to Swift corner radius proportions for all device types.
I would do this: save the height of the button (as for iPhone 13 pro max, probably defined in IB) in var defautButtonHeight: CGFloat then compute the radius: startButton.layer.cornerRadius = 30 * startButton.bounds.height / defautButtonHeight
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’21