-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from rlegault33/createReadMe
Create read me
- Loading branch information
Showing
3 changed files
with
88 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
osx_image: xcode12.2 | ||
language: swift | ||
script: | ||
- swift package generate-xcodeproj | ||
- xcodebuild test -destination 'platform=iOS Simulator,name=iPad (8th generation)' -scheme 'FileBrowserSUI-Package' -disableAutomaticPackageResolution | ||
|
||
github_token: ${{ secrets.PERSONEL_TOKEN }} | ||
branches: | ||
only: | ||
- main | ||
jobs: | ||
include: | ||
|
||
- stage: iOS Build and Test | ||
script: | ||
- swift package generate-xcodeproj | ||
- xcodebuild test -destination 'platform=iOS Simulator,name=iPad (8th generation)' -scheme 'FileBrowserSUI-Package' -disableAutomaticPackageResolution | ||
- stage: set tag | ||
script: | ||
- git config --global user.email "[email protected]" | ||
- git config --global user.name "R Legault" | ||
- git tag $PACKAGE_VERSION | ||
- git push --quite https://[email protected]/rlegault33/FileBrowserSUI --tag > /dev/null 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,71 @@ | ||
# FileBrowserSUI | ||
 | ||
|
||
[](https://travis-ci.com/rlegault33/FileBrowserSUI) | ||
 | ||
|
||
 | ||
|
||
[](https://github.com/apple/swift) | ||
[](https://developer.apple.com/documentation/swiftui) | ||
[](https://developer.apple.com/xcode/) | ||
|
||
|
||
|
||
# File Browser SUI | ||
iOS File Browser supporting Swift Packages. Use the default View or create your own and pass it on init to handle file selection. You can specify the starting path and include or exclude file types. | ||
|
||
:can: | Features | ||
--------------------------|---------------------------- | ||
:iphone: | Browse and select files and folders with a familiar UI on iOS. | ||
:eyeglasses: | Quickview most file types. | ||
:pencil: | Edit/delete files. | ||
:gear: | Fully customizable. | ||
:ballot_box_with_check: | Each file has the option to allow the user to flag files via (up to 2) check boxes. | ||
|
||
## Usage | ||
XCODE Select Project</br> | ||
File->Swift Package->Add Package Dependancy</br> | ||
Copy the following link into Choose Package Repository Search Field</br> | ||
[http://github.com/rlegault33/FileBrowserSUI](http://github.com/rlegault33/FileBrowserSUI) | ||
|
||
## Specify a file view | ||
You can create your own File handler view that you pass into the FileBrowserSUI on creation. When the user selects a file ti will use the view you specify. The view must have a variable url:URL that will contain the URL of the selected file. | ||
|
||
```swift | ||
struct AppFileSelectedView: View { | ||
let url: URL | ||
var body: some View { | ||
Text("Show File \(url.lastPathComponent)") | ||
} | ||
} | ||
``` | ||
|
||
Pass View to the package on init by adding a closure to the init call. If no closure is provided it will use the iOS Quickview functionality | ||
```swift | ||
FileBrowserSUI(initialPath: initPath) { value in | ||
AppFileSelectedView(url:value) | ||
} | ||
``` | ||
|
||
## Check mark | ||
For each check mark you must provide a instance of **FileExtraInfo** that you supply | ||
* title: String | ||
* set(URL, Bool) -> Void | ||
* get(URL) -> Bool | ||
* delete(URL) -> Bool | ||
|
||
It is your responsiblity to store the information by its URL as required by your app and supply it via the get() and update it via the set() and delete it from your storage. | ||
|
||
Usage Example: | ||
```swift | ||
FileBrowserGeneric(initialPath: initPath, | ||
xInfo0: FileExtraInfo(title: "Offense", get: fileMapInfo.get0, set: fileMapInfo.set0, delete: fileMapInfo.delete), | ||
xInfo1: FileExtraInfo(title: "Defense", get: fileMapInfo.get1, set: fileMapInfo.set1, delete: fileMapInfo.delete)) | ||
``` | ||
|
||
See the xcode project **Example_FileBrowser_SUI** in the FileBrowserSUI package for the full code. | ||
|
||
|
||
 | ||
|
||
A description of this package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters