Post

Replies

Boosts

Views

Activity

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
Reply to how to get the app delegate file on Xcode
Xcode 13 does not have a Life Cycle menu. New projects use the SwiftUI app life cycle.  I just tested in Xcode 1313.0ß. I created a new project, selected Storyboard, Swift language. I do get AppDelegate and SceneDelegate files created automatically. What you cannot do is have a SwiftUI project and select UIKit lifecycle. But that does not prevent to have a storyboard/UIKit project. Which is good news.
Jul ’21
Reply to Use of Airdrop systematically
Users must allow to be contacted by Airdrop by anyone or by you if you are in their contacts. Here is an implementation example (a bit old and ObjC, but that shows the logic): http s : / / w w w .appcoda. com/ios7-airdrop-programming-tutorial/ And implementation using UIActivityViewController http s : / / w w w . hackingwithswift. com/articles/118/uiactivityviewcontroller-by-example
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’21
Reply to Using Xcode 12.5.1 (current ver)
The same app run on any other simulator Which simulator precisely ? Is it related to screen size ? will not load the table properly. That's not enough information. what do you get exactly ? No table at all ? empty table ? Ill positioned table ? … Could you show: the full code related to tableView screen copy of the constraints you defined for the tableView
Topic: Programming Languages SubTopic: Swift Tags:
Jul ’21
Reply to How to refine the shape of an SKSpriteNode for tap gestures?
We can now include images, it is easier to have them in the post directly. I would try the following in tappedView: test where exactly the tap was and compare to the orange shape. If d is the semi width (and height) of the full square (position of orange top), the parts to exclude are: top left triangle : cond1 = x + y < d top right triangle : cond2 = x - y > d bottom right triangle : cone3 = x + y > 3 d bottom left triangle cond4 = y - x > d if let touchNode = node as? MyGem print("touched gem") if cond1 || cond2 || cond3 || cond4 { return // without doing anything } // else, OK highliteGem(theGem: touchNode, clearAll: false) return }
Topic: Programming Languages SubTopic: Swift 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:
Replies
Boosts
Views
Activity
Jul ’21
Reply to why it says "this class is not key value coding-compliant for the key forgotPassword.'?"
You should add a tapGesture on the label and implement the action in the tapGesture. Enable user interaction in the label.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Unable to use ios 12.4 simulators
Have you a launch screen defined for the app, in a LaunchScreen.storyboard ?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to How to programmingly go to icloud settings?
AFAIK, you can go either to the "entry" settings page and navigate from there, or to your app settings. But nowhere else directly. So, you should tell user how to proceed before going to Settings. Settings -> AppleID -> iCloud -> ManageStorage ->
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Wrong InfoPlist.strings file used by the app
Could you show what you get in the file list ? Should be like this:
Replies
Boosts
Views
Activity
Jul ’21
Reply to How to delete posts
You can't do it. https://developer.apple.com/forums/thread/681406 See also this discussion, and possibly participate. https://developer.apple.com/forums/thread/682019
Replies
Boosts
Views
Activity
Jul ’21
Reply to how to get the app delegate file on Xcode
Xcode 13 does not have a Life Cycle menu. New projects use the SwiftUI app life cycle.  I just tested in Xcode 1313.0ß. I created a new project, selected Storyboard, Swift language. I do get AppDelegate and SceneDelegate files created automatically. What you cannot do is have a SwiftUI project and select UIKit lifecycle. But that does not prevent to have a storyboard/UIKit project. Which is good news.
Replies
Boosts
Views
Activity
Jul ’21
Reply to Change icons border when click the bottom tab bar in Swift
I think you should change it in RootStackTabViewController, for the selected icon.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Pass Data from Swift to SwifUI
Did you try to use notifications, sent by Swift code and received by SwiftUI part ? Details here for notifications in SwiftUI: https://stackoverflow.com/questions/59552487/swiftui-with-notificationcenter-publishers
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Use of Airdrop systematically
Users must allow to be contacted by Airdrop by anyone or by you if you are in their contacts. Here is an implementation example (a bit old and ObjC, but that shows the logic): http s : / / w w w .appcoda. com/ios7-airdrop-programming-tutorial/ And implementation using UIActivityViewController http s : / / w w w . hackingwithswift. com/articles/118/uiactivityviewcontroller-by-example
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Using Xcode 12.5.1 (current ver)
The same app run on any other simulator Which simulator precisely ? Is it related to screen size ? will not load the table properly. That's not enough information. what do you get exactly ? No table at all ? empty table ? Ill positioned table ? … Could you show: the full code related to tableView screen copy of the constraints you defined for the tableView
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Strange line in UITextview
Does it occur on simulator or on device ? Could you show the code so that we can try to reproduce ?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Xcode & Simulator slow on launch
How much RAM ? How much disk space available ? Is it since you moved to Xcode 12.5.1 ? Or did it occur before ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to How to refine the shape of an SKSpriteNode for tap gestures?
We can now include images, it is easier to have them in the post directly. I would try the following in tappedView: test where exactly the tap was and compare to the orange shape. If d is the semi width (and height) of the full square (position of orange top), the parts to exclude are: top left triangle : cond1 = x + y < d top right triangle : cond2 = x - y > d bottom right triangle : cone3 = x + y > 3 d bottom left triangle cond4 = y - x > d if let touchNode = node as? MyGem print("touched gem") if cond1 || cond2 || cond3 || cond4 { return // without doing anything } // else, OK highliteGem(theGem: touchNode, clearAll: false) return }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’21
Reply to Xcode & Simulator slow on launch
8GB RAM is now a bit limited for Xcode. Could you monitor disk and memory use during launch, to see if you hit the 8 GB limit and swap to disk ? If not, try to reinstall Xcode.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jul ’21