Polish the code about "about repository"

- Move something to PasswordStore.swift
This commit is contained in:
Yishi Lin 2017-03-24 22:05:09 +08:00
parent c1bdc152c5
commit a36bb13004
2 changed files with 24 additions and 19 deletions

View file

@ -136,6 +136,23 @@ class PasswordStore {
}
let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
var numberOfPasswords : Int {
return self.fetchPasswordEntityCoreData(withDir: false).count
}
var sizeOfRepositoryByteCount : UInt64 {
let fm = FileManager.default
var size = UInt64(0)
do {
if fm.fileExists(atPath: self.storeURL.path) {
size = try fm.allocatedSizeOfDirectoryAtURL(directoryURL: self.storeURL)
}
} catch {
print(error)
}
return size
}
private init() {