【IOS沉思录】开发软硬件SDK支持以及Swift语言

【IOS沉思录】开发软硬件SDK支持以及Swift语言,第1张

概述iPhone和iPad 软件支持 iOS 2007年发布 2008年发布开发者SDK iOS当前的版本为:10.2 官方开发者论坛:Apple Developer Forums 官方开发者教程文档资源库:Resources 硬件支持 A10处理器(iPhone7/7+) A9处理器(iPhone6s/6s+) A8处理器(iPhone6/iPhone6+) A8X处理器(iPad Air2) A7
iPhone和iPad
软件支持 iOS 2007年发布 2008年发布开发者SDK iOS当前的版本为:10.2 官方开发者论坛:Apple Developer Forums 官方开发者教程文档资源库:Resources 硬件支持 A10处理器(iPhone7/7+) A9处理器(iPhone6s/6s+) A8处理器(iPhone6/iPhone6+) A8X处理器(iPad Air2) A7处理器(iPad Mini3),A7开始处理器为64位 运动辅助处理器(iPhone5s和iPad Air之后) 3D touch(iPhone6s/6s+之后) 亮度传感器 靠近设备感应器 多点触控(multi-touch)屏幕 加速 数字罗盘 三轴陀螺仪 辅助GPS(AGPS) 气压计(iPhone 6和iPad Air2之后) 指纹传感器(iPhone 5s和iPad Air2之后) 压力传感器(iPhone 6s and iPhone 7) 触觉反馈引擎(iPhone 6s and iPhone 7) 前后摄像头(模式可调分辨率)
Apple Watch和Apple TV
Apple Watch 软件支持 WatchOS(最前版本WatchOS 3.0) 硬件支持 处理器
苹果S1单片机 苹果S2单片计算机 传感器
环境光传感器 加速传感器和陀螺仪 心率传感器 GPS(只支持SerIEs2) 数据连接
蓝牙4.0(LTE) Wifi 802.11b/g/n 2.4 GHz(仅限在系统中使用) 充电
电感应充电 Apple TV(2015) 软件支持 Apple tvOS SDK available for Apps Development 硬件支持 处理器(A8) 遥控传感器
加速和陀螺仪 触摸传感器 Siri麦克风 数据连接
蓝牙4.0 (LE) 红外线接收器 820.11交流Wifi天线系统 10/100 BASE-T以太网 USB-C服务和支持
iOS SDK

2009年iPhone SDK 3.0发布,现在已经更新到iOS SDK 10.0。

iOS SDK 9.0/9.1特性 Apple Pay App应用程序扩展 touch ID指纹识别授权认证 Metal游戏引擎 HealthKit,HomeKit,iPad多任务切换改进功能 3D touch搜索GameplayKit App应用瘦身 从左到右的语言支持 Swift改进 iOS SDK 10.0新特性 SiriKit Callkit
集成VOIP 呼叫屏蔽 Homekit改进(在控制中心组织Homekit配件) Apple Pay改进 消息应用程序集成 Widget改进
iOS技术架构
Cocoa touch框架层
UI组件 触摸处理和事件驱动 系统接口 Media媒体层
音频视频播放 动画 2d和3d图形 Core ServIE核心服务层
底层特性 文件 网络 位置服务等 Core OS系统层
内存管理 底层网络 硬件管理
新型语言Swift(从OC到Swift)

Swift是一门新型语言,借鉴了Haskell,Ruby,Python,C#等语言特性,看上去偏脚本化,swift仍然支持已有的Cocoa和Cocoa touch框架。

Swift的主要新特性:

安全【严格的类型检查】 强大【高度优化的LLVM编译器】 新型【借鉴多种语言特性,表达更简单精确】 从基本的VIEwController代码窥探OC和Swift区别

Swift

// VIEwController.swiftimport UIKitclass VIEwController: UIVIEwController {    @IBOutlet weak var label1: UILabel!    @IBAction func button1(sender: AnyObject) {        label1.text = @H_894_301@"Hello iOS!!!"    }    overrIDe func vIEwDIDLoad() {        super.vIEwDIDLoad()        // Do any additional setup after loading the vIEw,typically from a nib.    }    overrIDe func dIDReceiveMemoryWarning() { super.dIDReceiveMemoryWarning()        // dispose of any resources that can be recreated.}

Objective-C

// VIEwController.h#import <UIKit/UIKit.h>@interface VIEwController : UIVIEwController@property (weak,nonatomic) IBOutlet UILabel *label1; - (IBAction)button1:(ID)sender;@end// VIEwController.m#import "VIEwController.h" @interface VIEwController () @end@implementation VIEwController @synthesize label1 ;- (voID)vIEwDIDLoad {    [super vIEwDIDLoad];    // Do any additional setup after loading the vIEw,typically from a nib.}- (voID)dIDReceiveMemoryWarning { [super dIDReceiveMemoryWarning];    // dispose of any resources that can be recreated.}- (IBAction)button1:(ID)sender {    label1.text = @@H_894_301@"Hello iOS!!!" ;}@end
Swift类的定义

整个类文件都定义在一个swift文件内:

import Foundationclass Ball {    // 变量    var centerX: float    var centerY: float    var radius: float    // 初始化方法    init(centerX:float,centerY:float,radius:float) {        self.centerX @H_570_419@= centerX        self.centerY @H_570_419@= centerY        self.radius @H_570_419@= radius    }    // 实例方法    func move(moveX:float,_ moveY:float) {        self.centerX @H_570_419@+= moveX        self.centerY @H_570_419@+= moveY    }    // 类方法    class func aClassMethod() {          print(@H_894_301@"I am a class method")    }}...// 创建对象var ball1 @H_570_419@= Ball(centerX: 7.0,centerY: 5.0,radius: 6.0)// 方法调用ball1.move(moveX:1.0,1.0)Ball.aClassMethod()
流程控制语句

Objective-c

// 条件判断if (a < b) {    // Do something here} else {    // Do another thing here}// for循环for (int i = 0; i < 10; i++){    // Do something here}// while循环while (count < 10) {    // Do something here}// do-while循环do {    // Do something here} while (count < 10);

Swift

// 条件判断if a < b {    // Do something here} else {    // Do another thing here}// for循环for int i = 0; i < 10; i++{    // Do something here}// while循环while count < 10 {    // Do something here}// repeat-while循环repeat {    // Do something here} while count < 10
基本数据类型 String字符串

Objective-C

Nsstring * Str = @@H_894_301@"string"; Nsstring * formatStr = [Nsstring stringWithFormat:@@H_894_301@"%@and float%f",Str,3.1415@H_894_301@"]; 

Swift

// 可变字符串var Str = @H_894_301@"string"var Str:String = @H_894_301@"string"var Str = String(@H_894_301@"string")// 不可变字符串let Str = @H_894_301@"string"let Str:String = @H_894_301@"string"let Str = String(@H_894_301@"string")
数组Array和MultableArray

Objective-C

// 静态数组NSArray *array = [[NSArray alloc] initWithObjects: ball1,ball2,nil];array[0].radius = 10;// 可变数组NSMutableArray *mArray = [[NSMutableArray alloc] initWithCapacity: 2];[mArray addobject:ball1];[mArray addobject:ball2];Ball *newball = [mArray objectAtIndex:1];[mArray removeObjectAtIndex:1];

Swift

// 静态数组let myArray: Array<Ball> = [ball1,ball2]let myArray: [Ball] = [ball1,ball2]let myArray = [ball1,ball2]myArray[0].radius = 10// 可变数组var myArray: [Ball] = []myArray.append(ball1)myArray.append(ball2)var newBall = myArray[1];myArray.remove(at: 0)
UIImageVIEw

Objective-C

UIImageVIEw *myImage = @H_894_301@[[UIImageVIEw alloc] initWithImage: [UIImage imagenamed:@”tiger.png”]];[self.vIEw addSubvIEw:myImage];myImage.center = CGPointMake(150,200);myImage.frame = CGRectMake(0,0,50,25);

Swift

let myImage = UIImageVIEw(image: UIImage(named: @H_894_301@"tiger.png"))vIEw.addSubvIEw(myImage)myImage2.frame = CGRect(x:0,y:0,wIDth:50,height:25)myImage2.center = CGPoint(x:150,y:200)

… …

总结

以上是内存溢出为你收集整理的【IOS沉思录】开发软硬件SDK支持以及Swift语言全部内容,希望文章能够帮你解决【IOS沉思录】开发软硬件SDK支持以及Swift语言所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1068374.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存