0
的Xcode可以從核心數據實體產生這樣的:對於@NSManaged變量,Fileprivate是否足夠?
// This file was automatically generated and should not be edited.
import Foundation
import CoreData
extension Media {
@NSManaged public var imageString: String?
}
我的同事已經編輯它來隱藏的字符串,只露出一個URL:
extension Media {
@NSManaged fileprivate var imageString: String?
public var image: URL? {
return imageString != nil ? URL(string: imageString!) : nil
}
}
是fileprivate
(或private
)即可使用在這種情況下?這是在Core Data中存儲URL的最佳實踐嗎?