enum Kind { case folder case general case archive case ... } let isDirectory: Bool private(set) var name: String private(set) var kind: Kind private(set) var isHidden: Bool ... private(set) var fileURL: URL private(set) weak var parent: FileNode? private var cachedChildren: [FileNode]? var children: [FileNode]? { if self.cachedChildren == nil, self.isDirectory { self.cachedChildren = try? self.readChildren() } return self.cachedChildren } }