Post

Replies

Boosts

Views

Activity

Reply to Taking user input in MapKit
Your solution can be the extra work. Google, search GitHub or reach the Apple Documentation, look at the sample code. Begin the base knowledge here: https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/LocationAwarenessPG/AnnotatingMaps/AnnotatingMaps.html#//apple_ref/doc/uid/TP40009497-CH6-SW1 Converting MKView touch to coordinates: https://gist.github.com/a1phanumeric/2249553
Dec ’21
Reply to Why is superview returning nil?
See the Apple document excerpt below. If calling animation didMove(toParent:) is called after the transition not inside of the animation block, no animation the immediately after the addChild. With animation @objc func buttonAction(sender: UIButton!) { guard let theButton = sender as? MyButton else { return} UIView.transition(with: self.view, duration: 0.5, options: .transitionCurlDown, animations: { [self] in self.addChild(setController) self.view.addSubview(setController.view) }, completion: { setController.didMove(toParent: self) }) } No animation @objc func buttonAction(sender: UIButton!) { guard let theButton = sender as? MyButton else { return} self.view.addSubview(setController.view) self.addChild(setController) setController.didMove(toParent: self) } Discussion Your view controller can override this method when it wants to react to being added to a container. If you are implementing your own container view controller, it must call the didMove(toParent:) method of the child view controller after the transition to the new controller is complete or, if there is no transition, immediately after calling the addChild(_:) method. The removeFromParent() method automatically calls the didMove(toParent:) method of the child view controller after it removes the child. Sundel: https://www.swiftbysundell.com/basics/child-view-controllers/
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’21
Reply to My app update is rejected
You're supposed to do exactly what #1 & #2 outline. Before just prompting the user with the Contacts permission request, show a screen to the user explaining to them why your app needs access to their private contacts data, what you're going to do with the data (Their entire address book) before calling the API for access to their Contacts. If all you need is an email or phone number, just create a screen and ask them to provide the email or phone number as part of your onboarding flow. Don't have a website? get one so you can provide a link to the privacy policy that governs your data usage policies.
Dec ’21
Reply to Cannot convert value of type 'ChooseModel.Angle' to expected argument type 'Angle'
struct ChooseModel: Codable { var id = UUID()     var decision: String     var choices: [String]     var startAngle: ChooseModel.Angle // Qualify Your type Angle by the `ChooseModel` namespace     var endAngle: ChooseModel.Angle // Qualify Your type Angle by the `ChooseModel` namespace     @CodableColor var color: UIColor     struct Angle: Codable, Equatable {         var degrees: Double     } } // Do this `-90 + chooseMV.model.[startAngle|endAngle].degrees` instead of `ChooseModel.Angle(degrees: -90.0).degrees` since the instance of `ChooseModel.Angle` is not used beyond these two lines. path.addArc(                         center: center,                         radius: width * 0.5,                         startAngle: -90.0 + chooseMV.model.startAngle.degrees, // startAngle are CGFloat types and not Angle types so you will to use the `degrees` properties of the Angle objects for the computation to CGFloat                         endAngle: -90.0 + chooseMV.model.endAngle.degrees, // endAngle are CGFloat types and not Angle types so you will to use the `degrees` properties of the Angle objects for the computation to CGFloat                         clockwise: false)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’21