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
| require 'find' | |
| require 'pp' | |
| swift_file_paths = [] | |
| Find.find('./') do |path| | |
| if path =~ /.*\.swift$/ and !path.start_with? "./Carthage" | |
| swift_file_paths << path | |
| cmd = "xcrun swift-update -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -target arm64-apple-ios9 #{path} > convert.swift" | |
| system cmd |
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
| extension UIHostingController { | |
| func capture() -> UIImage { | |
| let size = sizeThatFits(in: UIScreen.main.bounds.size) | |
| view.bounds.size = size | |
| view.sizeToFit() | |
| UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.isOpaque, 0) | |
| view.drawHierarchy(in: view.bounds, afterScreenUpdates: true) | |
| let snapshotImage: UIImage = UIGraphicsGetImageFromCurrentImageContext()! | |
| UIGraphicsEndImageContext() |
OlderNewer