Photo by Viktor Talashuk on Unsplash

While working with files, we might come across a situations to fetch the created date of file or size of file. The attributes of a file can be fetched in following way:

‘self.startAccessingSecurityScopedResource’ allows us to access the file in the URL securely.

‘FileManager.default.attributesOfItem(atPath: self.path)’ gives attributes of file.

From attributes array, select a file attribute key and cast the value to appropriate data type

Thanks for Reading:))

--

--

Photo by Brett Jordan on Unsplash

Core data objects confirms to Observable and each property is publishable. So we can use ‘@observedObject’ to observe changes of core data object. Let us look at a small example. A 2 screen app where a screen have a list of core data objects and the other screen provides option to edit property of core data object. By Using ‘@ObservedObject’ as below, the changes we make to the core data object are automatically reflected .

Thanks for reading :))

--

--