| 連結 | 介紹 |
|---|---|
| Swift protocol extension | 介紹如何用 Swift 實作一個 API Request client (What),會大量使用 Protocol extension (How) 特性來擴充這個模組,近而讓程式變得容易維護且擴充性高 (Why)。 |
| 使用 Swift 寫爬蟲 | 使用 XPath + Swift 套件 爬 104 頁面 |
| memory overuse debug | 如何找出記憶體飆升的過程 |
| SwiftSliderMenu | 實作側邊選單的機制 |
| WLAppleCalendar | 實作蘋果內建的行事曆 |
| Ted-subtitle-merge | 合併 Ted 中英字幕 |
| TableViewCell reuseIdentifier refactor | 一步一步重構TableViewCell_reuseIdentifier 的過程 |
| [NSArray.count-and-arithmetic-underflow](https://github.com/willard1218/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // ViewController.swift | |
| // text | |
| // | |
| // Created by willard on 2018/4/2. | |
| // Copyright © 2018年 willard. All rights reserved. | |
| // | |
| import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // XXXTableVC.swift | |
| // t | |
| // | |
| // Created by willard on 2018/3/17. | |
| // Copyright © 2018年 willard. All rights reserved. | |
| // | |
| import Foundation | |
| import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // XXXTableVC.swift | |
| // t | |
| // | |
| // Created by willard on 2018/3/17. | |
| // Copyright © 2018年 willard. All rights reserved. | |
| // | |
| import Foundation | |
| import UIKit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //: Playground - noun: a place where people can play | |
| import UIKit | |
| let a = NSDecimalNumber(string: "1.111111111111111111") | |
| a.intValue | |
| a.int8Value | |
| a.int16Value | |
| a.int32Value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // origin author : https://gist.github.com/pofat/b0a05cd0348878e23027eae4273f0bed | |
| //: Playground - noun: a place where people can play | |
| import UIKit | |
| // This is for dmoe, you can use a generice type to limit your observer to an UIViewController for common usage. | |
| protocol Notifiable { | |
| var name: Notification.Name { get } | |
| func observe(by observer: Any, withSelector selector: Selector, object: Any?) | |
| func post(object: Any? ,userInfo: [AnyHashable: Any]?) | |
| static func remove(observer: Any) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // usage 1 | |
| extension Notification.Name { | |
| public static let updateData = Notification.Name("updateData") | |
| // nested | |
| struct Category1 { | |
| public static let nestedUpdateData = Notification.Name("nestedUpdateData") | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| protocol SomeP {} | |
| struct Foo: SomeP { | |
| var foo : String = "foo" | |
| } | |
| extension Array where Element == SomeP { | |
| func m1() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const WebSocket = require('ws'); | |
| const wss = new WebSocket.Server({ port: 8080 }); | |
| wss.on('connection', function connection(ws) { | |
| ws.on('message', function incoming(data) { | |
| console.log("reveice : " + data) |