Unable to specify path when creating Realm instance

Asked 5 months ago, Updated 5 months ago, 18 views

let realm=try!Realm (path: path name you want to read)

It used to be possible as shown in , but after the Realm version reaches 1.0,

Argument labels' (path:) 'do not match any available overloads

The warning message now appears.

How do I resolve this warning?
Is there an alternative argument to path?

swift realm

2022-09-30 11:46

1 Answers

The path argument was recently changed to the parameter fileURL to match Swift's standard library.


From now on, use Realm(fileURL:) or

try!Realm (fileURL:NSURL(fileURLWithPath: "/path/to/file")))

Configure the file path using Realm.Configuration.


2022-09-30 11:46

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.