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 is an update to an example found on http://www.jairobjunior.com/blog/2016/03/05/how-to-rotate-only-one-view-controller-to-landscape-in-ios-slash-swift/ | |
The code there works, with some updating to the latest Swift, but the pattern isn't very Swifty. The following is what I found to be more helpful. | |
*/ | |
/* | |
First, create a protocol that UIViewController's can conform to. | |
This is in opposition to using `Selector()` and checking for the presence of an empty function. | |
*/ |
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
# Turn on the simulator screen capture | |
xcrun simctl io booted recordVideo ~/simulator.mov | |
# Convert the iPhone 6s screen shot into a gif: | |
ffmpeg -i ~/simulator.mov -vf scale=320:-1 -r 6 -f gif -y simulator.gif |
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
enum JSON: Decodable { | |
case bool(Bool) | |
case double(Double) | |
case string(String) | |
indirect case array([JSON]) | |
indirect case dictionary([String: JSON]) | |
init(from decoder: Decoder) throws { | |
if let container = try? decoder.container(keyedBy: JSONCodingKeys.self) { | |
self = JSON(from: container) |
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
protocol Initializable { | |
init() | |
} | |
class A : Initializable { | |
var content:String | |
required init() { | |
content = "TestContent" | |
} |
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
#!/usr/bin/env bash | |
rm -rf "${HOME}/Library/Caches/CocoaPods" | |
rm -rf "`pwd`/Pods/" | |
pod update |