Post

Replies

Boosts

Views

Activity

Reply to Slide over UIViews To Select
You need to track the finger position using func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent) and func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent) Then compute which bar it is and display information accordingly in touchesMoved.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jul ’21
Reply to why it says "this class is not key value coding-compliant for the key forgotPassword.'?"
I want to use segue when I click the forget password icon , I do not see any segue in your code, just an IBAction call… One of the frequent reasons for such a crash is that you miss a connection to an IBOutlet from the storyboard, or that this connection is corrupted (if you have changed a name for instance). So, remove all connections from IN to LoginViewController and rebuild them. Do a clean build folder after, in case. Note: you have a typo (missing an n): forgotPasswordEmailCheckCotroller. But that's not the cause of the problem. Why don't you set directly the storyboard ID ForgotPasswordEmailCheckController directly in IB ?
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’21
Reply to Calculation of maximum speed and traveled distance Core Location
When you init a CLLocation, you can ask to get speed info at each measure. Then, store this value in an array. And evaluate the max value in the array to get max speed, when you need. What distance do you want to measure: the travelled or the distance from origin ? For travelled distance, each time you get a CLLocation value, compute the distance from previous point (if update is frequent enough, evaluate this as sort(dx*dx + dy+dy) where (dx, dy) is the delta between the two CLLocation. Then increment a totalDistance Float value to compute the travelled distance so far. May read this for implementation details. https://stackoverflow.com/questions/38512443/provide-simple-method-to-get-current-speed-implementing-speedometer
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’21
Reply to Adding functionality to JSONDecoder (json decoding)
Did you try to use Any as type in struct. Here is a simple illustration (in playground): struct Test { var value: Any } let v1 = Test(value: 1 as Any) let v2 = Test(value: true as Any) let v3 = Test(value: "true" as Any) let tests = [v1, v2, v3] var result : Bool for (i, v) in tests.enumerated() { if let valueInt = v.value as? Int { print("An Int for v\(i+1)") ; result = valueInt == 1 } if let valueBool = v.value as? Bool { print("A Bool for v\(i+1)") ; result = valueBool } if let valueString = v.value as? String { print("A String for v\(i+1)") ; result = valueString == "true" } } Which yields: An Int for v1 A Bool for v2 A String for v3
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’21