iOS8

原文鏈接:http://nshipster.com/ios8/

前言

本文章主旨在於揭示如下各大標題下對應內容的特性,以及分享一些比較晦澀但卻又必須瞭解的API。

NSProcessInfo -isOperatingSystemAtLeastVersion

可以用來比較當前系統版本:

import Foundation

let yosemite = NSOperatingSystemVersion(majorVersion: 10, minorVersion: 10, patchVersion: 0)
NSProcessInfo().isOperatingSystemAtLeastVersion(yosemite) // false

我們可以基於目標任務得弓箭配置環境來有條件的編譯源代碼。

New NSFormatter Subclasses

iOS8和OS X Yosemite推出了NSEnergyFormatter, NSMassFormatter, & NSLengthFormatter三種單位。【注:主要是爲了HealthKit服務】

NSEnergyFormatter

NSEnergyFormatter單位是焦耳,運動能量使用單位,卡路里是營養能量單位。

let energyFormatter = NSEnergyFormatter()
energyFormatter.forFoodEnergyUse = true

let joules = 10_000.0
println(energyFormatter.stringFromJoules(joules)) // "2.39 Cal"

NSMassFormatter

記住HealthKit中處理用戶體重是使用NSMassFormatter

let massFormatter = NSMassFormatter()
let kilograms = 60.0
println(massFormatter.stringFromKilograms(kilograms)) // "132 lb"

NSLengthFormatter

CMPedometer

CMAltimeter

CLFloor

HKStatistics

NSStream +getStreamsToHostWithName

NSString -localizedCaseInsensitiveContainsString

CTRubyAnnotationRef

New Calendar Identifiers

NSURLCredentialStorage

kUTTypeToDoItem

kCGImageMetadataShouldExcludeGPS

kCGImageMetadataShouldExcludeGPS

WKWebView

NSQualityOfService

LocalAuthentication

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章