This file contains hidden or 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
import UIKit | |
/// An enum that defines an output to be passed on from | |
/// a child to it's parents over the responders Chain | |
public protocol CoordinatorOutput {} | |
/// An enum that defines an input to be passed on from | |
/// the parent to it's childs | |
public protocol CoordinatorInput {} |
This file contains hidden or 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
import UIKit | |
class BookCollectionViewCell: UICollectionViewCell { | |
var book: Book! | |
func configureCellWith(_ book: Book) { | |
self.book = book | |
} | |
This file contains hidden or 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
weak var viewControllerPreviewing: UIViewControllerPreviewing! | |
override func awakeFromNib() { | |
super.awakeFromNib() | |
if self.traitCollection.forceTouchCapability == .available { | |
if viewControllerPreviewing != nil { | |
sourceVC.unregisterForPreviewing(withContext: viewControllerPreviewing) | |
} | |
viewControllerPreviewing = sourceVC.registerForPreviewing(with: self, sourceView: self) | |
} |
This file contains hidden or 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
weak var sourceVC: UIViewController! | |
//make it weak to avoid retain cycle | |
func registerFor3DTouch(viewController: UIViewController?) { | |
if let viewController = viewController { | |
sourceVC = viewController | |
} | |
} |
This file contains hidden or 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
class IqraaliCollectionViewCell: UICollectionViewCell { | |
var book: BookEntity! | |
} | |
extension BookCollectionViewCell: UIViewControllerPreviewingDelegate { | |
func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? { | |
return AboutBookViewControllerWith(book) | |
} |
This file contains hidden or 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
import Foundation | |
extension String { | |
func fileName() -> String { | |
return URL(fileURLWithPath: self).deletingPathExtension().lastPathComponent | |
} | |
func fileExtension() -> String { | |
return URL(fileURLWithPath: self).pathExtension | |
} |
This file contains hidden or 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
import Vapor | |
/// Register your application's routes here. | |
public func routes(_ router: Router) throws { | |
let imageResizeController = ImageResizeController() | |
try router.register(collection: imageResizeController) | |
} |
This file contains hidden or 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
struct FilesHelper { | |
//get image path in Public folder | |
static func getImagePath(fileName:String) -> URL{ | |
let directory = DirectoryConfig.detect() | |
let workingDirectory = directory.workDir | |
let workingDirectoryPath = URL(fileURLWithPath:workingDirectory) | |
let destination = workingDirectoryPath.appendingPathComponent("Public/\(fileName)") | |
return destination |
This file contains hidden or 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
import Vapor | |
import SwiftGD | |
final class ImageResizeController: RouteCollection { | |
func boot(router: Router) throws { | |
let routes = router.grouped("resize") | |
routes.get(use: index) | |
} |
This file contains hidden or 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
.package(url: "https://github.com/twostraws/SwiftGD.git", from: "2.0.0") |