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
28
results
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
•
Updating Realm and RealmSwift from 5.5.x to 10.0.0 brought in the following...
Andrew Fletcher
•
After creating a new view with a @Binding string as follows
struct EditRival:...
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
•
Today while in Terminal, I ran a regular script pod update. However, this...
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
•
How to apply a gradient tint over a background image?
Set the background...
Andrew Fletcher
•
For detailed notes regarding how to add custom fonts to your iOS app see Apple's custom font notes.
When using the font programmatically, remember that the font file name most of the time will not be the font name. For example, I wanted to use SF-Pro-Text-Bold and its font name is SFProText-Bold. If you want to check the font name, add the following script
for family in UIFont.familyNames.sorted() {
let names = UIFont.fontNames(forFamilyName: family)
print("Family:...
Andrew Fletcher
•
Working on formatting the date in Xcode, and you come across the situation where...
Andrew Fletcher
•
Adding a floating decimal point for n number of places is quite easy to achieve....