Storyboard
- SizeClass
Session 222 - Making Apps Adaptive, Part 1
Session 233 - Making Apps Adaptive, Part 2
- Autolayout
GCD
let queue = DispatchQueue(label: ”com.example.queue")
queue.async {
}
let mainQueue = DispatchQueue.main
let gloabelQueue = DispatchQueue.global()
Session 720 - Concurrent Programming With GCD in Swift 3
Core Graphics
if let ctx = UIGraphicsGetCurrentContext() {
let rectangle = CGRect(x: 0, y: 0, width: 512, height: 512)
ctx.setFillColor(UIColor.blue().cgColor)
ctx.setStrokeColor(UIColor.white().cgColor)
ctx.setLineWidth(10)
ctx.addRect(rectangle)
ctx.drawPath(using: .fillStroke)
UIGraphicsEndImageContext()
}
Image Renderer
- 以前:
func createDrawing(size: CGSize) -> UIImage {
let renderer = UIGraphicsBeginImageContext(size)
// Do your drawing here
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
- 现在:
func createDrawing(size: CGSize) -> UIImage {
let renderer = UIGraphicsImageRenderer(size: size)
return renderer.image { rendererContext in
}
}
func createPdf(bounds: CGRect, to url: URL) {
let renderer = UIGraphicsPDFRenderer(bounds: bounds)
try? renderer.writePDF(to: url) { rendererContext in
}
}
Speech Recognition
import Speech
let recognizer = SFSpeechRecognizer()
let request = SFSpeechURLRecognitionRequest(url: audioFileURL)
recognizer?.recognitionTask(with: request, resultHandler: { (result, error) in
print (result?.bestTranscription.formattedString)
})
Session 509 - Speech Recognition API
Dynamic Type
- 支持 label, textView,controls
label.font = UIFont.preferredFont(forTextStyle: UIFontTextStyleBody)
label.adjustsFontForContentSizeCategory = true
Tab bar items
- 可以自定义badge color, text attribute, unselected tint color
tabBarItem.badgeColor = UIColor.white()
badgeTextAttributes = [ NSForegroundColorAttributeName : UIColor.blue(),
NSFontAttributeName : UIFont.italicSystemFont(ofSize: 12) ] tabBarItem.setBadgeTextAttributes(textAttributes: badgeTextAttributes,
forState: UIControlStateNormal)
tabBar.unselectedTintColor = UIColor.brown()
UIViewPropertyAnimator
let timing = UICubicTimingParameters(animationCurve: .easeInOut)
let animator = UIViewPropertyAnimator(duration: duration, timingParameters: timing)
animator.addAnimations {
self.squareView.center = CGPoint(x: point.x, y: point.y)
}
animator.startAnimation()
Session 216 - Advances in UIKit Animations and Transitions
ReplayKit
- 支持直播
Go Live with ReplayKit