Latest 0.0.1
Homepage https://github.com/arkasas/APFileManager
License MIT
Platforms ios 10.0
Authors

AFileManager

Simple file manager

Getting Started

This is a very simple file library that allows you minimalise your works with files.

Features

  • [x] Read/Write file
  • [x] Read/Write Image (.png, .jpeg)
  • [x] Delete file
  • [x] Create/Remove directory

Requirements

  • iOS 8.0+
  • Xcode 8.1+
  • Swift 3.0+

Installing

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate APFileManager into your Xcode project using CocoaPods, specify it in your Podfile:

target '<Your Target Name>' do
    pod 'APFileManager', '~> 0.0.1'
end

Then, run the following command:

$ pod install

Usage

Recommended usage

Create 3 directory into your project root directory {image, document, music}

import APFileManager

APFileManager.start();

Enums

    UserDefaultDictionary
    ImageFormat

UserDefaultDictionary contains default directory {image, document, music}. ImageFormat contains two possible picture format {PNG, JPEG}.

Functions

To create directory

CreateDirectory(name: String)

To remove directory

RemoveDirectory(name: String)

To create file

SaveFile(name: String, directory: String, data: Data?)
SaveFile(name: String, directory: String, text: String)
SaveFile(name: String, directory: UserDefaultDictionary, data: String)
SaveImage(name: String, directory: String, image: UIImage, format: ImageFormat)
SaveImage(name: String, directory: String, image: UIImage, format: ImageFormat, quality: CGFloat)
SaveImage(name: String, directory: UserDefaultDictionary, image: UIImage, format: ImageFormat)
SaveImage(name: String, directory: UserDefaultDictionary, image: UIImage, format: ImageFormat, quality: CGFloat)
SaveFile(name: String, directory: String, data: Data, completion: @escaping (_ result: Bool) -> Void)
SaveFile(name: String, directory: UserDefaultDictionary, data: Data, completion: @escaping (_ result: Bool) -> Void)
SaveImage(name: String, directory: String, image: UIImage, format: ImageFormat, quality: CGFloat = 1.0, completion: @escaping(_ result: Bool) -> Void)
SaveImage(name: String, directory: UserDefaultDictionary, image: UIImage, format: ImageFormat, quality: CGFloat = 1.0, completion: @escaping(_ result: Bool) -> Void)

To remove file

RemoveFile(name: String, directory: String)

To open file

OpenFile(name: String, directory: String)
OpenTextFile(name: String, directory: String)
OpenTextFile(name: String, directory: UserDefaultDictionary)
OpenImageFile(image name: String, directory: String)
OpenImageFile(image name: String, directory: UserDefaultDictionary)
OpenFile(name: String, directory: String, completion: @escaping(_ result: Data?) -> Void)
OpenFile(name: String, directory: UserDefaultDictionary, completion: @escaping(_ result: Data?) -> Void)
OpenImage(name: String, directory: String, completion: @escaping(_ result: UIImage) -> Void)
OpenImage(name: String, directory: UserDefaultDictionary, completion: @escaping(_ result: UIImage) -> Void)
OpenTextFile(name: String, directory: String, completion: @escaping(_ result: String) -> Void)
OpenTextFile(name: String, directory: UserDefaultDictionary, completion: @escaping(_ result: String) -> Void)

To check is file exist

IsFileExist(path: String)
IsFileExist(name: String, directory: String)
IsFileExist(name: String, directory: UserDefaultDictionary)

To get files list

GetFiles(inDirectory name: String, resourceKeys: [URLResourceKey]?)
GetFiles(inDirectory name: UserDefaultDictionary, resourceKeys: [URLResourceKey]?)
GetFiles(inDirectory name: String, resourceKeys: [URLResourceKey]?, completion: @escaping(_ result: [URL]) -> Void)
GetFiles(inDirectory name: UserDefaultDictionary, resourceKeys: [URLResourceKey]?, completion: @escaping(_ result: [URL]) -> Void)

License

This project is licensed under the MIT License – see the LICENSE file for details

Latest podspec

{
    "name": "APFileManager",
    "version": "0.0.1",
    "summary": "Simple File Manager",
    "description": "Simple file manager",
    "homepage": "https://github.com/arkasas/APFileManager",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Arek Pitula": "[email protected]"
    },
    "source": {
        "git": "https://github.com/arkasas/APFileManager.git",
        "tag": "0.0.1"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "APFileManager/APFileManager.swift",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This