Swift
abnerwang_smile
主力博客http://abnerwang.github.io/
展开
-
Swift 笔记(十)
我的主力博客:半亩方塘Dictionaries1、A dictionary is an unordered collection of pairs, where each pair is comprised of a keyand a value. The same key can’t appear twice in a dictionary, but differen原创 2016-03-03 11:22:31 · 665 阅读 · 0 评论 -
Swift 笔记(八)
我的主力博客:半亩方塘Arrays1、You can declare an array either explicitly or taking advantage of Swift's type inference. Here's an example of an explicit declaration:let numbers: ArraySw原创 2016-02-27 16:08:29 · 526 阅读 · 0 评论 -
Swift 笔记(七)
我的主力博客:半亩方塘Optionals1、Optionals are Swift's solution to the problem of representing both a value and the absence of a value. An optional type is allowed to reference either a val原创 2016-02-27 15:47:45 · 489 阅读 · 0 评论 -
Swift 笔记(六)
我的主力博客:半亩方塘Closures1、Closures are functions without names. Here's a declaration for a varible that can hold a closure:var mutiplyClosure: (Int, Int) -> Int You assign a closure原创 2016-02-27 15:41:23 · 647 阅读 · 0 评论 -
Swift 笔记(五)
我的主力博客:半亩方塘Functions1、With two parameters, the function can print out a multiple of any two values. You could achieve this like so:func printMultipleOf(multiplier: Int, andValu原创 2016-02-27 15:30:18 · 491 阅读 · 0 评论 -
Swift 笔记(四)
我的主力博客:半亩方塘Making Decisions1、Consider this code:let number = 10switch (number) {case let x where x % 2 == 0: print("Even")default: print("Odd")} This will pri原创 2016-02-27 15:22:36 · 497 阅读 · 0 评论 -
Swift笔记(一)
我的主力博客:半亩方塘1、In Swift, you can optionally use underscores to make larger numbers more human-readable. The quantity and placement of the underscores is up to you.var variableNumber: Int = 1_0原创 2016-01-12 21:39:35 · 709 阅读 · 0 评论 -
Swift 笔记(三)
StringsIt's possible to add characters to a string. However, Swift's strictness with types means you have to be explicit when doing so, just as you have to be when you work with numbers if one is原创 2016-02-27 15:07:58 · 729 阅读 · 0 评论 -
Swift 笔记(二)
我的主力博客:半亩方塘Numeric Types & Operations1、In Swift, you can even use the modulo operate with fractional numbers, like so:let moduloDecimal = 11.6 % 1.2In this case, modu原创 2016-02-27 15:01:16 · 492 阅读 · 0 评论 -
Swift 笔记(九)
我的主力博客:半亩方塘Randomizing an arrayThe function below returns a random number between 0 and the given argument:import Foundationfunc randomFromZeroTo(number: Int) -> Int { return原创 2016-02-29 18:41:23 · 622 阅读 · 0 评论