Skip to content

Commit b968689

Browse files
committed
add singleton
1 parent bd6267e commit b968689

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
3+
public extension ReverseGeoCodeService {
4+
5+
private static var service: ReverseGeoCodeService?
6+
private static var databasePath = "../Data/geocitydb.sqlite"
7+
8+
static func SetDatabase(path:String) {
9+
databasePath = path
10+
}
11+
12+
static var main:ReverseGeoCodeService {
13+
get {
14+
guard let unwrapservice = service else {
15+
service = ReverseGeoCodeService(database:databasePath)
16+
return service!
17+
}
18+
return unwrapservice
19+
}
20+
}
21+
22+
}

0 commit comments

Comments
 (0)