-
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.
Rename Generic to FileBrowserSUIPreview.
Moved views into their own file
- Loading branch information
1 parent
bd8b3e8
commit 73f4eae
Showing
3 changed files
with
73 additions
and
52 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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Richard Legault on 2021-01-17. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
public struct FileBrowserSUIPreview: View { | ||
@State var fileList:[FBFile] = [] | ||
internal var didAppear: ((Self) -> Void)? | ||
let validInitialPath: URL | ||
let extraInfo0: FileExtraInfo? | ||
let extraInfo1: FileExtraInfo? | ||
|
||
public var body: some View { | ||
FileBrowserSUI(initialPath: validInitialPath, | ||
xInfo0: extraInfo0, xInfo1: extraInfo1) { | ||
fileUrl in | ||
PreviewController(url: fileUrl) | ||
} | ||
} | ||
|
||
public init(initialPath: URL?, xInfo0:FileExtraInfo?, xInfo1: FileExtraInfo?) { | ||
validInitialPath = initialPath ?? FileParser.sharedInstance.documentsURL() | ||
extraInfo0 = xInfo0 | ||
extraInfo1 = xInfo1 | ||
|
||
} | ||
public init() { | ||
validInitialPath = FileParser.sharedInstance.documentsURL() | ||
extraInfo0 = nil | ||
extraInfo1 = nil | ||
|
||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// ThumbnailImageView.swift | ||
// | ||
// | ||
// Created by Richard Legault on 2021-01-17. | ||
// | ||
|
||
import SwiftUI | ||
|
||
public struct ThumbnailImageView: View { | ||
let fbFile: FBFile | ||
|
||
@State private var thumbnail: UIImage? = nil | ||
|
||
public var body: some View { | ||
|
||
if thumbnail != nil { | ||
Image(uiImage: self.thumbnail!) | ||
} else { | ||
Image(uiImage: fbFile.type.image()).onAppear() { | ||
self.fbFile.generateImage() { image in | ||
self.thumbnail = image | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
//struct ThumbnailImageView_Previews: PreviewProvider { | ||
// static var previews: some View { | ||
// | ||
// //ThumbnailImageView(fbFile: <#FBFile#>) | ||
// } | ||
//} | ||
|