developer resources
Codebales holds an ever growing number of solutions to problems that we have experienced in our day to day code writing
Selected filter
45
results
Andrew Fletcher
•
In SwiftUI, has made creating a list of item very easy. If you have an array containing the names of customers, these names can be displayed through the following code:
struct ContentView: View {
let customers = ["Sarah","Vinodh","Dimitry","Lata"]
var body: some View {
List(customers){customer in
Text(customer)
}
}
}As you will have noticed, this is a static list. Meaning that any changes to the customers array will not cause...
Andrew Fletcher
•
I attempted the run command and the response I had was succeeded, but then...
Andrew Fletcher
•
Working with buttons
To begin, what is a button in SwiftUI?
struct MainView:...
Andrew Fletcher
•
When those simple annoyances are too frustrating! Yes we have all been...
Andrew Fletcher
•
To add ejabberd and run MYSQL to the server I needed to update the server...
Andrew Fletcher
•
The purple warning notification of annoyance recently came my way! I received the following warning:
Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.
What was happening?
The functionality of the code uses URLSession to get a user's name via API and the display is simple piece that initially message of Hello {user}.
The view code consists of:
MainView : View
Main...
Andrew Fletcher
•
I'm currently working on a project that requires login, register, forget...
Andrew Fletcher
•
iOS localization on the fly
If you have added languages to your app......
Andrew Fletcher
•
After creating a new view with a @Binding string as follows
struct EditRival:...
Andrew Fletcher
•
Building a contact list using SwiftUI has many challenges.
One challenge is...
Andrew Fletcher
•
What to do when you want to filter a Realm object, using NSPredicate in SwiftUI or in Swift.
Applying the filter to a simple condition in one line
let exists = realm.objects(ExampleObj.self).filter(NSPredicate(format: "uid = %ld", uid))Creating a variable predicate that will be injected as a condition
let predicate = NSPredicate(format: "uid = %ld AND nid = %ld",uid,nid)
let exists = realm.objects(ExampleObj.self).filter(predicate)Finally, managing the predicate as an array by...
Andrew Fletcher
•
I'm going to take you on a journey about adding a gradient tint to a...
Andrew Fletcher
•
Creating a new SwiftUI project is a quick process. There are already...
Andrew Fletcher
•
The starting point is to read through and follow the notes outlined on the...