swift学习_xcode基础学习
2014-06-27 16:46
375 查看
android L已经在开发大会上公布了, 技术得跟上时代的潮流, 一心想在移动互联网中发展,只好努力学习 html+ js , oc ! 服务器运维我就不写了,就算是自己的生活记录。android 说真心话, 一直想写,结果发现自己很喜欢写得连续点,就像仙剑一样, 应该是能让人回味的那种,文笔不好 , 就先这些基础开始练习吧。
发呆中。。。。。
上一个教程中 xcode6 安装后,打开xcode开始界面,我突然发现 get start playground , 一直在犹豫他是神马。。。。
点击get start playground 之后,界面有大惊喜,这个是html 常会出现的实时页面, 记得用blog写md 语法的时候 ,就是这样的页面。。。。
好吧, var js的节奏啊 !! 瞬间激动了, 难道oc和js 合体了, swift果然是神器
。
接下来部分代码
发呆中。。。。。
上一个教程中 xcode6 安装后,打开xcode开始界面,我突然发现 get start playground , 一直在犹豫他是神马。。。。
点击get start playground 之后,界面有大惊喜,这个是html 常会出现的实时页面, 记得用blog写md 语法的时候 ,就是这样的页面。。。。
好吧, var js的节奏啊 !! 瞬间激动了, 难道oc和js 合体了, swift果然是神器
。
接下来部分代码
// Playground - noun: a place where people can play import Cocoa var str = "Hello, playground" //变量 var x = 0.0, y = 0.0, z = 0.0 let numInt = 10 //常量 /** *多行注释 */ println(str) //输出函数 println(numInt) println("str is \(str) num is \(numInt)") /** *需要注意Double */ let anotherPi = 3 + 0.14159 // anotherPi 会被推测为 Double 类型 let decimalInteger = 17 let binaryInteger = 0b10001 // 二进制的17 let octalInteger = 0o21 // 八进制的17 let hexadecimalInteger = 0x11 // 十六进制的17 很喜欢0x ,让我想起了做游戏外挂时的痛苦,读取内存基址 /** * 元组 java中map的马甲,先这么理解吧 */ let http404Error = (404, "Not Found") let (statusCode, statusMessage) = http404Error println("The status code is \(statusCode)") // 输出 "The status code is 404" println("The status message is \(statusMessage)") // 输出 "The status message is Not Found" let (justTheStatusCode, _) = http404Error println("The status code is \(justTheStatusCode)") // 输出 "The status code is 404" 只需要一部分元组值,分解的时候可以把要忽略的部分用下划线(_)标记 println("The status code is \(http404Error.0)") // 输出 "The status code is 404" 下标方式取值 println("The status message is \(http404Error.1)") // 输出 "The status message is Not Found" 下标方式取值 let http200Status = (statusCode: 200, description: "OK") //凌乱了, 居然可以这样写, 这是map<String , Object> 先这么理解吧。
相关文章推荐
- 学习IOS开发UI篇--Xcode基础知识及storyboard搭建
- Swift编程语言教程-001入门学习基础
- Swift学习——Swift基础详解(七)
- Swift学习笔记1——基础部分
- swift学习日志-1基础篇 基础运算符
- xcode+OC基础学习
- Swift教程_通过改造官方Sample学习Swift(二)_Swift基础(简单值、控制流、方法和闭包)
- Swift学习——Swift基础详解(六)
- Swift学习笔记一(基础部分)
- S008 - iOS 应用基础 swift版 - 系统学习 iOS 界面编程
- swift开发环境搭建[零基础学习Swift开发](二)
- Xcode 6中学习Swift、CloudKit 和 Testflight
- Swift学习——Language Guide 基础
- swift学习笔记(六)——基础语法的总结
- Swift学习——Swift基础详解(三)
- 介绍篇[零基础学习Swift开发](一)
- Swift基础学习二
- Swift学习——Swift基础详解(一)
- 【Swift】学习笔记(一)——初识 基础数据类型,代码风格,元组,断言
- ios swift学习日记2-基础部分