Skip to content

Instantly share code, notes, and snippets.

View lexuanquynh's full-sized avatar
👋
coding ...

Quynh lexuanquynh

👋
coding ...
View GitHub Profile
/// DatabaseConfigurable all defines which you must conform according
public protocol DatabaseConfigurable {
var realmMemoryType: RealmMemoryType { get }
// This property you must assign the database name that you want.
// If you want to use legacy architecture you can assign nil for it.
// If you want to use legacy architecture you can assign nil for it.
var schemaName: String? { get }
// This property you must assign the database version according to the migration count.
public init(fileURL: URL? = URL(fileURLWithPath: RLMRealmPathForFile("default.realm"), isDirectory: false),
inMemoryIdentifier: String? = nil,
syncConfiguration: SyncConfiguration? = nil,
encryptionKey: Data? = nil,
readOnly: Bool = false,
schemaVersion: UInt64 = 0,
migrationBlock: MigrationBlock? = nil,
deleteRealmIfMigrationNeeded: Bool = false,
shouldCompactOnLaunch: ((Int, Int) -> Bool)? = nil,
objectTypes: [ObjectBase.Type]? = nil,
let numbers = [0, 2, 4, 6]
let allEven = numbers.filter { $0 % 2 != 0 }.isEmpty
let numbers = [0, 2, 4, 6]
let allEven = numbers.allSatisfy { $0 % 2 == 0 }
let numbers = [0, 4, 2, 8]
let minNumber = numbers.sorted().first
let maxNumber = numbers.sorted().last
let numbers = [0, 4, 2, 8]
let minNumber = numbers.min()
let maxNumber = numbers.max()
let numbers = [3, 7, 4, -2, 9, -6, 10, 1]
let firstNegative = numbers.filter { $0 < 0 }.first
let numbers = [3, 7, 4, -2, 9, -6, 10, 1]
let firstNegative = numbers.first(where: { $0 < 0 })
let numbers = []
numbers.count == 0
let numbers = []
numbers.isEmpty