Post

Replies

Boosts

Views

Activity

Reply to Rendering an application on multiple device sizes
And should i be editing this directly in the main.storyboard?  You added the tag SwiftUI, but if you are using Main.storyboard, you are not using SwiftUI, but using UIKit. And the answer is YES. What you have written happens when you have not added enough constraint on the storyboard. It is very hard to say something sure without seeing your storyboard settings, but better try to add/edit constraints on the storyboard. If there are some warnings generated while build time, they can be some hint about how to fix.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to Xcode single view app
The project template named “single view app” is removed from recent versions of Xcode. The template App is equivalent to Single View App, so choose it. Seems you are using a very old tutorial? (In Xcode world, one year is very old.) Please do not forget to choose the right values for Interface and Life Cycle. You should better find a tutorial (or a book?) written for the version of Xcode you are using.
Mar ’21
Reply to Thread 1: Fatal error: No ObservableObject of type msgDatas found. A View.environmentObject(_:) for msgDatas may be missing as an ancestor of this view.
Brother as I said u, u are not here for solution, u just ask question  I do not understand why you insult me spending plenty of hours finding to solve your issue. I ask you questions because I need them to solve your issue. I am sure I can solve your issue when you could show enough info. I will be watching this thread. When you will show enough info, I will try to help you solve your issue. Or if you solve it by yourself, please share your solution.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to Integrate Metal/ObjC Tutorial into SwiftUI
is this the best venue to ask Apple to update/integrate their tutorials? No. Apple's engineer would answer to the questions on certain technical topics allowed. But other than that, Apple has never responded to the posts in the dev forums. Better use the feedback assistant - https://developer.apple.com/bug-reporting/ to tell some request on development issue. (Unfortunately, you should better not expect Apple would respond to the feedback immediately and clearly.) As for now, what you are asking is sort of vague and hard to answer. If you could show some details including what you have done till now and focus on more specific topic, you would get better responses.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21
Reply to Custom popup: UIView or UIViewController?
what do you mean exactly? When you show a UIAlertController, you would write something like this: let alertController = ... instantiate `UIAlertController` ... set up `alertController` present(alertController, animation: true, completion: nil) With keeping this flow, you can write something for your custom popup: let customPopup = ... instantiate your custom popup ... set up `customPopup` present(customPopup, animation: true, completion: nil)
Mar ’21
Reply to Custom popup: UIView or UIViewController?
This may be just a problem of preference, but I would choose UIViewController. But the UI of which can be put in a .xib or in its own .storyboard or in the existing storyboard, or you may construct it programmatically as in UIAlertController. Though I would not use segue. With using UIViewController, you can present it as well as UIAlertController and can utilize any animation effects prepared for view transitions. In fact, UIAlertController is a subclass of UIViewController, so if you make your custom popup as a subclass of UIViewController, it may be easier to switch from UIAlertController to your custom popup.
Mar ’21
Reply to Modify API to remove empty names.
so I'm thinking since I used my original array to filter them that the problem must be with the API getting the empty names, the json has names with null. Sorry, I do not understand what you mean. Are you saying it is a problem of API calling and no need to filter any more? Or do you still want to fix the behavior of filer?
Mar ’21
Reply to Do not repeat question, removeAtIndex
Thanks for showing additional context. Generally it is better to include whole method at least, preferably whole struct or whole class. It is not clear enough, for example, how nextQuestion and currentQuestion are used? How do you get the value of index? All such things may affect. But I will do my best guess to write an answer under the currently shown info. First set up unusedQuestions where you initialize gameModels: var unusedQuestions: [Question] = [] private func setupQuestions() { gameModels.append(Question(text: "How old am I", answers: [ Answer(text: "18", correct: false), Answer(text: "21", correct: true), Answer(text: "20", correct: false), Answer(text: "None Of The Above", correct: false) ])) gameModels.append(Question(text: "Where am I from?", answers: [ Answer(text: "NZ", correct: true), Answer(text: "Australia", correct: false), Answer(text: "France", correct: false), Answer(text: "US", correct: false) ])) unusedQuestions = gameModels } And use unusedQuestions like this: if let index = unusedQuestions.indices.randomElement() { let nextQuestion = unusedQuestions[index] unusedQuestions.remove(at: index) currentQuestion = nil configureUI(question: nextQuestion) self.scoreBoard += 1 self.scoreLabel.text = String(scoreBoard) //questionsAsked += 1 //- You can calculate `questionsAsked` with `gameModels.count - unusedQuestions.count` } else { print("No more unused questions") } If you find something difficult to apply my sample code to your project, please tell me with detailed info about it.
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’21
Reply to My view isn't displaying the Navigation Title and I can't change the background colour
With using your code exactly as is -- Navigation Title is shown correctly It is not clear on which element you have tried to add gradient background As far as I know, SwiftUI List (at least in iOS) covers its background with some default color, so usual ways which are effective to other views would not work. Can you show enough code to reproduce the issue? Including view hierarchy to your SettingsView and ZStack{ LinearGradient....
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’21