Post

Replies

Boosts

Views

Activity

SwiftUI Cloudkit - simple list records from public Db in view
HI All,i am brand new to this and am just starting to learn about swiftui in 2020 so have no knowledge of everything that came before.I have created an app that uses cloudkit. I have a public database with some test data in.All i am wanting is a very basic explanation of how to get that data from the cloudkit public database into a list in my app.I have a a record type called Shoes, in the record i have (brand, name, size)I would like the user to have a list of all shoes that appeer in that database.I would also appreciate filenames to go along with this if there is code in more than one file as i have been getting a little lost with the best practices of where to put code.I know this is a big ask but i cannot find anything simple and strightforward out there in this new iteration of a language.Thanks In Advance,Kind RegardsAdam
2
0
1.1k
Jun ’20
Where to store dynamic options
I am brand new to iOS app building and resultantly have some basic questions. When building a web app in php for example I would store options in the database. So for example if I had a list of ingredients to add to a shopping list, all of the items that could be chosen would exist in the database and be pulled into the list. My question is, when making an iOS app, where do I store this info so that I can very easily add more options to the list. I don't really want to use json and I don't want to hard code it, nor do I want to use a third party DB. I am assuming that these will be in core data or cloud kit but I can't find the answers I am looking for. Help is appreciated.
0
0
520
Dec ’20
Create @State vars dynamically
Hi, I have a form that will have a number of TextFields depending on the data that is passed in. As i need to record what has been entered into these TextFields, i need state vars. The content is created dynamically but i also need to create the State Vars. Could someone please explain how this would be done. This is my code so far. import SwiftUI struct CandidateReview: View { var reviewScore = ["Terrible", "Poor", "Average", "Good", "Excellent"] var reviewCriterias = ["Communication", "Time Management", "Work Ethic", "Creativity", "Teamwork", "General"] var candidateName = "John Doe" @State private var selectedReviewScore = "Average" @State private var scoreNotes = "" var body: some View { NavigationStack{ Form{ ForEach(reviewCriterias, id: \.self) { reviewCriteria in Section(header: Text(reviewCriteria)){ Picker("\(reviewCriteria) Score", selection: self.$selectedReviewScore){ ForEach(reviewScore, id: \.self){ Text($0) } } NavigationLink(destination: NavigationView { Form { TextField(text: $scoreNotes, label: {}) }.navigationTitle("\(reviewCriteria) review notes") } ){ Text("This is the text that is shown") } } } } .navigationTitle(candidateName) } } } #Preview { CandidateReview() }
2
0
358
Aug ’24