Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions LithoUtils/Classes/Base/Alert/ImagePickerAlert.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// ImagePickerAlert.swift
// LithoUtils
//
// Created by Calvin Collins on 12/3/21.
//

import Foundation
import fuikit
import LithoOperators

public func imagePickerAlert(vc: UIViewController, imagePicker: UIImagePickerController, title: String? = "How do you want to upload your picture?", message: String? = nil) -> UIAlertController {
let alert = actionSheetPopoverSafe(title: title, message: message, sourceView: vc.view)
alert.addAction(defaultAlertAction(title: "Camera", handler: ignoreArg({ [weak vc] in
guard let vc = vc else { return }
if UIImagePickerController.isSourceTypeAvailable(.camera) {
imagePicker.sourceType = .camera
}
alert.dismissAnimated(imagePicker *> vc.presentClosure())
})))
alert.addAction(defaultAlertAction(title: "Library", handler: ignoreArg({ [weak vc] in
guard let vc = vc else { return }
imagePicker.sourceType = .photoLibrary
if UIImagePickerController.isSourceTypeAvailable(.photoLibrary) {
alert.dismissAnimated(imagePicker *> vc.presentClosure())
}
})))
alert.addAction(cancelAlertAction(title: "Cancel", handler: ignoreArg(nil *> alert.dismissClosure())))
return alert
}
2 changes: 1 addition & 1 deletion LithoUtils/Classes/Base/Functions/OpenUrl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ import Foundation
import LithoOperators
import UIKit

public let openUrl = URL.init(string:) >?> (([:], nil) -**> UIApplication.shared.open)
public let openURL = URL.init(string:) >?> (([:], nil) -**> UIApplication.shared.open)