Post

Replies

Boosts

Views

Activity

Reply to SCNNode not at the center
I don't know, I would have expected them to be both 0, right? No, screen center should be close to the values you get. No, I did not. What exactly do you mean by that? that, you mean Did you try to debug the view hierarchy ? When you run code in simulator, if you breakpoint, then you will see on the line at top of console panel a series of icons. The seventh from the left is the debug hierarchy (icon is like this 🀓) When you click, you will see the realtime view displayed and you can rotate the view to see all objects. Try to see if some are off bounds. Maybe this could help you (even though it is more ARKit, but that may help you understand what's occurring): https://stackoverflow.com/questions/55906182/how-to-position-scenenode-always-at-the-center-of-the-sceneview-while-using-arfa
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’21
Reply to Cannot find 'segmentedControl' in scope?
Looks like you have not defined segmentedControl anywhere. In fact, you have to use sender (which is in fact the segmentedControl). Just change as: @IBAction func genderButton(_ sender: UISegmentedControl) { switch sender.selectedSegmentIndex { case 0: userGender = "Female" case 1: userGender = "Male" default: return } } If that's OK, please don't forget to close the thread by marking the correct answer (it seems you have several other threads that you didn't close ; please do it as well)
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’21
Reply to Learning Swift my comparing Objective-C
If you search Comparison between Swift and objC, you will find a lot of material. Just for illustration: https:// www.educba. com/ swift-vs-objective-c/ Some of the major difference between Swift vs Objective C: ••• Swift is the latest programming language that is developed by Apple and can be run on various cross-platform operating systems such as Linux, Darwin, Free BSD, etc., whereas Objective C is a general-purpose, object-oriented programming language used by Apple in its operating systems and APIs Cocoa, etc. ••• Swift has several programming features such as safe programming patterns, syntax like Objective C, complete access to Cocoa frameworks, whereas Objective C also supports the same features as C++ except for STL and includes foundational frameworks. ••• Swift has object-oriented and procedural features in its language and in-built functionalities in its library, whereas Objective C has different data types, tokens to recognize the identifiers, declarations and assignments and pre-processor to define constants. ••• Swift supports different operators such as Arithmetic Operators, Logical Operators, Bitwise Operators, Relational Operators, Assignment Operators, Range Operators, and Miscellaneous Operators, whereas Objective C also supports the same operators except for range and pre-processors which are not part of the compilation process. ••• Swift supports Dictionaries, Functions, Closures, Enumerations, Structures, etc., whereas Objective C supports Posing, Extensions, Dynamic Binding, Protocols, Composite Objects, Memory Management, and Enumerations. ••• Swift supports optional chaining, typecasting, generics, protocols, subscripts, etc., whereas Objective C allows dynamic dispatch, auto-generation of accessors to access member variables and properties and allows a method and a name to share the same identifier. ••• In Swift, calling a method will be decided at compile time and is similar to object-oriented programming, whereas in Objective C, calling a method will be decided at runtime, and also Objective C has special features like adding or replacing methods like on a class which already exists. ••• In Swift, errors can be handled using protocols to avoid the unexpected flow of program control, whereas Objective C has nil which can be safely handled in a powerful way by safely sending messages to nil objects. ••• In Swift, operator overloading is supported and is global in terms of scope and simple, whereas Objective C does not support default parameters but can be implemented by multiple methods manipulation and also do not support private members. ••• In Swift, Arc (Automatic Reference Counting) is the feature that handles the garbage collection where emptied memory is allocated to the required processes. In contrast, Objective C does not support stack-based memory objects and allocating memory in Objective C is very expensive. It plays a key role in writing successful programs for the delivery of efficient applications. ••• In Swift, class objects are declared normally. They are similar to that of general object-oriented programming languages. In contrast, Objective C has a composite object feature with an embedded object inside an object, which means a private cluster object will be embedded into the main object and some primitive methods. ••• In Swift, advanced operators exist to handle the manipulation of the complex value, whereas Objective C has a fast enumeration feature where collections are core components of this feature. There are also translators from objC to Swift (each on web), but they do not handle all languages features. Just for basic conversion. Why do you need this comparison ? Maybe you are an objC expert ? Anyway, it may not the best idea to try to learn by comparison. I feel it is better to learn Swift per se, and then find out, when needed how to port something to wifi if you convert some code.
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’21
Reply to insert Json file into core Data
Now I do not know what to do next.  next… do you mean insert in CoreData ? If so, you will find a lot of useful information here https://stackoverflow.com/questions/51869261/save-json-to-coredata-as-string-and-use-the-string-to-create-array-of-objects/51873317
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’21
Reply to insert Json file into core Data
I would first convert the list into an array. let recettes = "{[{\"title\" : \"Mini pork pies with piccalilli\", \"category\" : \"meat\"}, {\"title\" : \"apple crumble\", \"category\" : \"dessert\"}]}" define a Decodable class . ``` class Receipt: Decodable { } Have a look here https://stackoverflow.com/questions/30480672/how-to-convert-a-json-string-to-a-dictionary
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’21
Reply to Getting picker selected value with api data
Here is a small example that hope may help: struct ContentView: View { var activities = ["Run", "Walk", "Swim"] @State private var selectedActivity = 0 var body: some View { Picker(selection: $selectedActivity, label: Text("Activity").frame(width: 200,alignment: .center)) { ForEach(0 .. activities.count) { Text(self.activities[$0]) } .pickerStyle(WheelPickerStyle()) } Text("You selected: \(self.activities[selectedActivity])") } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’21
Reply to Learning Swift
What is it you want to know ? There are a lot of articles on the web is you search Understanding iOS Architecture. Surch as: https:// medium. com/@lucideus/understanding-the-structure-of-an-ios-application-a3144f1140d4 Or this tutorial: https:// www.raywenderlich. com/477-design-patterns-on-ios-using-swift-part-1-2 https:// www.raywenderlich. com/476-design-patterns-on-ios-using-swift-part-2-2 Or the Stanford course for iOS which is excellent. But the best way to learn by doing: imagine a simple application of your own, even if it is not targetting the AppStore, and start design it. You will understand how all pieces join together or at least clarify the questions you may have. The example may be anything: related to your pets, to your hobbies, to the books you read…
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’21
Reply to I have found NullIsland - Simulator
Did you see this explanation ? https://stackoverflow.com/questions/64952663/strange-nullisland-warning-from-coremotion-framework Apparently this error message is logged if property location of a CLLocationManager is read, before the CLLocationManager delivered the very first location.
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’21
Reply to URL scheme in Info.plist
So, the url does not work when directly entered in Safari ? Did you try with h t t p s instead of h t t p Could you show the first part of URL, with the beginning of the payload (not the complete one) ? Could you show also how you create and use the URL ? There is probably an issue in the url itself ; may be need to escape some characters ? The length should not be the problem: https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
Topic: App & System Services SubTopic: Core OS Tags:
Apr ’21