zoukankan      html  css  js  c++  java
  • Swift 笔记

    苹果官方文档

    https://developer.apple.com

    CocoaChina帮助文档

    http://www.cocoachina.com/special/swift/

    

    74个Swift标准库函数

    http://letsswift.com/2014/06/74-swift-library-functions/

    Swift中的问号?和感叹号!

    http://letsswift.com/2014/06/swift-questionmark-exclamatorymark/

    打开另一个storyboard

    https://github.com/gin7758258/StoryboardWarp

    Alert

    extension  UIViewController {
        func Alert(msg:String)
        {
            var alert = UIAlertController(title: nil, message: msg, preferredStyle: .Alert)
            
            alert.addAction(UIAlertAction(title: "OK", style: .Cancel, nil))
            
            self.presentViewController(alert, animated: true, completion: nil)
        }
    }

    生成

    http://blog.csdn.net/renzha0401/article/details/7107069

    字符串取下标

     当我第一次遇到这个问题时,简直疯了,我忍不住要骂 设计者的亲娘。 

    var str = "hello" ;

    str[0]  不让取。

    从字符串取某一个,也要这么高姿态:

    str[ advance( str.startIndex , 0) ]

    Swift 的设计者------------------吃屎长大的吧。

    苹果的设计者 ------------------有这种设计的土壤,也是吃屎长大的。

    使用苹果系统的人 , 简直是脑残无极限!!!

    http://oleb.net/blog/2014/07/swift-strings/

    http://www.cocoachina.com/bbs/read.php?tid-207275.html

    String 扩展方法: http://blog.csdn.net/yang3wei/article/details/7609457

    String.Index 转换为 Int 的方法:

    var someValue =   ( "ab".rangeOfString("b")?.startIndex )!

    var intValue = "(someValue)".toInt()

     

     问候他全家,总算实现了。

    SwiftHTTP,SwiftyJSON

    SwiftHttp 这个库在网上资料很多,但运行效率非常差,是一个大坑。老老实实的看原始API,自己封装。

    SwiftyJSON也完全没必要引用。系统API,也不错。

    C# 对应

    http://www.cocoachina.com/swift/20141002/9779.html

    1.  C# 的 params 参数列表的 Swift 对应

    func helloWithNames(names: String...) {  }

    2. C# 默认值的 Swift 对应

    func hello(name: String = "you") {

        println("hello, (name)")
    }

    3. 像C#一样,不指定参数:

    func hello( _ name:String) {}

    4. C# 的  out 参数

    var name1 = "Mr. Potato"
    var name2 = "Mr. Roboto"
     
    func nameSwap(inout name1: String, inout name2: String) {
        let oldName1 = name1
        name1 = name2
        name2 = oldName1
    }
     
    nameSwap(&name1, &name2)

     JS交互

    http://blog.csdn.net/cnsxhza985/article/details/20053839

    Svn

    svn checkout http://192.168.1.2:10081/svn/app

    开源项目:

    http://www.swiftmi.com/code4swift/43.html

    对应的开源代码地址: https://github.com/yaojunguang/Cocktail-Pro

     

     

  • 相关阅读:
    linux安装nginx
    python-- python threadpool 的前世今生
    如何用 Go 实现热重启
    使用expect快速登录线上机器
    curl 使用手册
    date命令时间戳和时间之间的转换
    linux设置程序运行超时时间
    你见过的最全面的python重点
    golang学习之旅:使用go语言操作mysql数据库
    Python多进程编程
  • 原文地址:https://www.cnblogs.com/newsea/p/4085311.html
Copyright © 2011-2022 走看看