predicate realm bool swift
import RealmSwift
class User: Object {
dynamic var isRegistered = true
}
let realm = Realm()
realm.write {
realm.add(User())
}
let p1 = NSPredicate(format: "isRegistered == YES")
let p2 = NSPredicate(format: "isRegistered == true")
let p3 = NSPredicate(format: "isRegistered == %@", NSNumber(bool: true))
let p4 = NSPredicate(format: "isRegistered = YES")
let p5 = NSPredicate(format: "isRegistered = true")
let p6 = NSPredicate(format: "isRegistered = %@", NSNumber(bool: true))
for predicate in [p1, p2, p3, p4, p5, p6] {
println("users matching \(predicate): \(realm.objects(User).filter(predicate))")
}
Also in Swift:
- store bool value in nsuserdefaults swift
- time formats swift
- set button programmatically swift
- swift change enum value
- swift thread.sleep
- swift remove tableview cell
- swift uitextfield only numbers keyboard lock programmatically
- convert string to int swift
- swift from 1 to 01
- swift open url
- fnb swift code
- print things in swift
- swift get day from available string
- swift temporary directory
- .next() enum swift
- limit log file size swift
- swiftui background color
- swift switch
- swift close app
- hide bottom tab bar swift
- show alert swiftui
- set image width and height swiftui
- how to show notification icon on tabbar item swift
- dart capitalize first letter of each word