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
private func cameraPreviewObfuscationImage(from image: CIImage, with blurRadius: CGFloat, at targetSize: CGSize) -> UIImage? { | |
var blurAdjustedTargetSize = targetSize | |
if targetSize.width > targetSize.height { | |
blurAdjustedTargetSize.height += blurRadius * 2 | |
} else { | |
blurAdjustedTargetSize.width += blurRadius * 2 | |
} | |
let croppedImage = image.cropped(to: AVMakeRect(aspectRatio: blurAdjustedTargetSize, insideRect: image.extent)) |
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
UIViewController *(^topmostViewControllerForFrontmostNormalLevelWindow)(void) = ^UIViewController *{ | |
// NOTE: Adapted from various stray answers here: | |
// https://stackoverflow.com/questions/6131205/iphone-how-to-find-topmost-view-controller/20515681 | |
UIViewController *viewController; | |
for (UIWindow *window in UIApplication.sharedApplication.windows.reverseObjectEnumerator.allObjects) { | |
if (window.windowLevel == UIWindowLevelNormal) { | |
viewController = window.rootViewController; | |
break; |
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
// | |
// UIImage+QRCode.h | |
// | |
// Created by Ben Guild on 2017/09/17. | |
// Copyright © 2017年 Ben Guild. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
@interface UIImage (QRCode) |