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
extension UIImage { | |
func resizeVI(size:CGSize) -> UIImage? { | |
let cgImage = self.CGImage! | |
var format = vImage_CGImageFormat(bitsPerComponent: 8, bitsPerPixel: 32, colorSpace: nil, | |
bitmapInfo: CGBitmapInfo(rawValue: CGImageAlphaInfo.First.rawValue), | |
version: 0, decode: nil, renderingIntent: CGColorRenderingIntent.RenderingIntentDefault) | |
var sourceBuffer = vImage_Buffer() | |
defer { | |
sourceBuffer.data.dealloc(Int(sourceBuffer.height) * Int(sourceBuffer.height) * 4) |
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
extension UIImage { | |
func resizeUI(size:CGSize) -> UIImage? { | |
UIGraphicsBeginImageContextWithOptions(size, true, self.scale) | |
self.drawInRect(CGRect(origin: CGPointZero, size: size)) | |
let resizedImage = UIGraphicsGetImageFromCurrentImageContext() | |
UIGraphicsEndImageContext() | |
return resizedImage | |
} | |
} |
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
// derived from https://www.veasoftware.com/posts/uipageviewcontroller-in-swift-xcode-62-ios-82-tutorial | |
import UIKit | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
window = UIWindow(frame: UIScreen.mainScreen().bounds) | |
window!.rootViewController = ViewController() |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Open App</title> | |
<!-- | |
URL Params: | |
customSchemeURL: Your custom scheme app |
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
# Convert the .cer file into a .pem file: | |
$ openssl x509 -in aps_development.cer -inform der -out PushChatCert.pem | |
# Convert the private key’s .p12 file into a .pem file: | |
$ openssl pkcs12 -nocerts -in PushChatKey.p12 -out PushChatKey.pem | |
# Finally, combine the certificate and key into a single .pem file | |
$ cat PushChatCert.pem PushChatKey.pem > ck.pem | |
# At this point it’s a good idea to test whether the certificate works. |