FileManagerExample - File Manager Example With Swift

Overview

FileManagerExample

FileManager를 쉽게 설명하기 위한 문서입니다.

    let fileManager = FileManager.default
    let documentsURL = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0]

보통 위의 코드처럼 FileManager를 사용할 때, 싱글턴 객체를 이용하여 urls를 통해 for, in의 매개변수들을 사용합니다. for은 SearchPathDirectory 으로 값을 받고 있으며, in은 SearchPathDomainMask으로 받고있습니다.

####요약하면 for : 폴더 위치, in : 접근제어 라고 보시면 됩니다.

##SearchPathDomainMask -먼저 FileManager의 위치 권한 SearchPathDomainMask 를 보면 다음과 같이 나뉘어져 있다.

    public struct SearchPathDomainMask : OptionSet {

        public init(rawValue: UInt)

        
        public static var userDomainMask: FileManager.SearchPathDomainMask { get } // user's home directory --- place to install user's personal items (~)

        public static var localDomainMask: FileManager.SearchPathDomainMask { get } // local to the current machine --- place to install items available to everyone on this machine (/Library)

        public static var networkDomainMask: FileManager.SearchPathDomainMask { get } // publically available location in the local area network --- place to install items available on the network (/Network)

        public static var systemDomainMask: FileManager.SearchPathDomainMask { get } // provided by Apple, unmodifiable (/System)

        public static var allDomainsMask: FileManager.SearchPathDomainMask { get } // all domains: all of the above and future items
    }

##Simulator 실행 결과

    let documentsURL = fileManager.urls(for: .documentDirectory, in: .userDomainMask)[0]
    //결과값
    //file:///Users/janghyowon/Library/Developer/CoreSimulator/Devices/6F684BD3-AD68-416F-98A2-DF6333813AFD/data/Containers/Data/Application/1C8689AA-6EF7-44A2-B85A-B2E138EDB7D2/Documents/
    
    let documentsURL = fileManager.urls(for: .documentDirectory, in: .allDomainsMask)[0]
    //결과값
    //file:///Users/janghyowon/Library/Developer/CoreSimulator/Devices/6F684BD3-AD68-416F-98A2-DF6333813AFD/data/Containers/Data/Application/B177AA48-D9BB-4921-B264-82230C49722F/Documents/

##Simulator 실행 불가값

  • localDomainMask
  • networkDomainMask
  • systemDomainMask
You might also like...
Edit a file, create a new file, and clone from Bitbucket in under 2 minutes

Edit a file, create a new file, and clone from Bitbucket in under 2 minutes When you're done, you can delete the content in this README and update the

LinkedLog is a Xcode plugin that includes a Xcode PCH header file template that adds the macros `LLog` and `LLogF` and parses their output to link from the console to the corresponding file and line.
LinkedLog is a Xcode plugin that includes a Xcode PCH header file template that adds the macros `LLog` and `LLogF` and parses their output to link from the console to the corresponding file and line.

LinkedLog Xcode Plugin LinkedLog is a Xcode plugin that includes a Xcode PCH file template that adds the macros LLog and LLogF. The LLog macro will wo

Task-Manager - Task Manager App With Swift
Task-Manager - Task Manager App With Swift

Task-Manager It's typical task manager where user can assign the importance, def

RavynOS File manager built in Cocoa/Appkit and ObjC

Filer A file manager and re-implementation of macOS's Finder. A key component of ravynOS, Filer is the first application you see after you start ravyn

NintendoSwitch-BezierPath-Example - Nintendo Switch Bezier Path Example

NintendoSwitch-BezierPath-Example An example app that demonstrates the use of Be

Assignment 2 - A fully functional example in the CardinalKit-Example directory
Assignment 2 - A fully functional example in the CardinalKit-Example directory

Assignment 2 - A fully functional example in the CardinalKit-Example directory

Socket framework for Swift using the Swift Package Manager. Works on iOS, macOS, and Linux.

BlueSocket Socket framework for Swift using the Swift Package Manager. Works on iOS, macOS, and Linux. Prerequisites Swift Swift Open Source swift-4.0

RSA public/private key encryption, private key signing and public key verification in Swift using the Swift Package Manager. Works on iOS, macOS, and Linux (work in progress).

BlueRSA Swift cross-platform RSA wrapper library for RSA encryption and signing. Works on supported Apple platforms (using Security framework). Linux

RSA public/private key encryption, private key signing and public key verification in Swift using the Swift Package Manager. Works on iOS, macOS, and Linux (work in progress).

BlueRSA Swift cross-platform RSA wrapper library for RSA encryption and signing. Works on supported Apple platforms (using Security framework). Linux

Socket framework for Swift using the Swift Package Manager. Works on iOS, macOS, and Linux.

BlueSocket Socket framework for Swift using the Swift Package Manager. Works on iOS, macOS, and Linux. Prerequisites Swift Swift Open Source swift-5.1

API surface for Swift plug-ins using the Swift Plugin Manager

SwiftPlugin The minimal API surface required for the Swift Plugin Manager to create instances from a loaded plugin. Additional documentation and refer

Swift Modules, a swift module (or package) manager

Swift Modules The Swift Modules manager similar to the JavaScript world's npm and bower

Swift Package Manager command plugin for Swift-DocC

Swift-DocC Plugin The Swift-DocC plugin is a Swift Package Manager command plugin that supports building documentation for SwiftPM libraries and execu

Swift Package Manager plugin which runs ActionBuilder to create a Github Actions workflow for a swift package.

ActionBuilderPlugin A Swift Package Manager command which builds a Github Actions workflow for the current package. By default the workflow file will

CSVParser - A swift library for fast read and write CSV file

CSVParser A swift library for fast read and write CSV file. This library supports all Apple platform and Linux. List to do get column by string subscr

FileKit is a Swift framework that allows for simple and expressive file management.
FileKit is a Swift framework that allows for simple and expressive file management.

FileKit is a Swift framework that allows for simple and expressive file management.

File management and path analysis for Swift
File management and path analysis for Swift

Pathos offers cross-platform virtual file system APIs for Swift. Pathos is implement from ground-up with on each OS's native API. It has zero dependen

A debug log framework for use in Swift projects. Allows you to log details to the console (and optionally a file), just like you would have with NSLog() or print(), but with additional information, such as the date, function name, filename and line number. File downloading library for Swift 3
File downloading library for Swift 3

VeloxDownloader About: VeloxDownloader is an easy to use,elegant, native yet powerfull download library made with Swift 3. It abstracts all the comple

Owner
Jackson
Jackson
Bluejay is a simple Swift framework for building reliable Bluetooth LE apps.

Bluejay is a simple Swift framework for building reliable Bluetooth LE apps. Bluejay's primary goals are: Simplify talking to a single Bluetooth LE pe

Steamclock Software 1k Dec 13, 2022
An open-source Swift framework for building event-driven, zero-config Multipeer Connectivity apps

PeerKit An open-source Swift framework for building event-driven, zero-config Multipeer Connectivity apps Usage // Automatically detect and attach to

JP Simard 861 Dec 23, 2022
Bluetooth mapping in Swift

Bluetonium is part of the E-sites iOS Suite. Bluetonium is a Swift Library that makes it easy to communicate with Bluetooth devices. Features ?? Servi

E-sites 165 Nov 20, 2022
An app for questioning people to try on different names and pronouns. A winner of the Swift Student Challenge 2022.

DiscoverMe is an app for questioning, trans, nonbinary, and gender-nonconforming people to try on different names and pronouns that better suit their

Joshua Tint 6 Oct 2, 2022
The official Swift Library for Vital API, HealthKit and Devices

vital-ios The official Swift Library for Vital API, HealthKit and Devices Install We currently support SPM. Documentation Please refer to the official

Vital 17 Dec 22, 2022
Swift implementation of Xiaomi's BLE authentication

MiAuth Xiaomi M365/Mi Authentication library written in Swift. Features M365 Authentication Mi Authentication (WIP - Login doesn't work reliably yet)

null 2 Jul 27, 2022
The Bluetooth LE library for iOS and Mac. 100% Swift.

iOS-BLE-Library An in-development Bluetooth Low Energy Library by Nordic Semiconductor to interact with the , which is not complicated, but requires w

Nordic Semiconductor 6 Dec 19, 2022
Capacitor File Opener. The plugin is able to open a file given the mimeType and the file uri

Capacitor File Opener. The plugin is able to open a file given the mimeType and the file uri. This plugin is similar to cordova-plugin-file-opener2 without installation support.

Capacitor Community 32 Dec 21, 2022
An Adobe .ase (Adobe Swatch Exchange File), .aco (Photoshop swatch file) reader/writer package for Swift (macOS, iOS, tvOS, macCatalyst)

ColorPaletteCodable A palette reader/editor/writer package for iOS, macOS, watchOS and tvOS, supporting the following formats Adobe Swatch Exchange (.

Darren Ford 11 Nov 29, 2022
ips2crash is a macOS command line too to convert a .ips file to a legacy .crash log file.

Synopsis ips2crash is a macOS command line too to convert a .ips file to a legacy .crash log file. Motivation It should be possible to read .ips file

null 36 Nov 25, 2022