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 CommonCrypto | |
| // MARK: AES128 暗号、復号化 | |
| public extension String { | |
| func aesEncrypt(key: String, iv: String) -> String? { | |
| guard | |
| let data = self.data(using: .utf8), | |
| let key = key.data(using: .utf8), | |
| let iv = iv.data(using: .utf8), |
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 CommonCrypto | |
| // MARK: AES128 暗号、復号化 | |
| public extension String { | |
| func aesEncrypt(key: String, iv: String) -> String? { | |
| guard | |
| let data = self.data(using: .utf8), | |
| let key = key.data(using: .utf8), | |
| let iv = iv.data(using: .utf8), |
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
| func makePNGFromView(view: NSView) { | |
| var rep = view.bitmapImageRepForCachingDisplayInRect(view.bounds)! | |
| view.cacheDisplayInRect(view.bounds, toBitmapImageRep: rep) | |
| if let data = rep.representationUsingType(NSBitmapImageFileType.NSPNGFileType, properties: [:]) { | |
| data.writeToFile("/xxx/image.png", atomically: false) | |
| } | |
| } |