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 Foundation | |
| import UIKit | |
| print("==== Basic ====") | |
| // Automatic Reference Counting | |
| class A { | |
| func hello() -> String { | |
| return "world" |
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
| /// 範例中使用了 SVProgressHUD, SwiftyJSON | |
| /// 另外 UIAlertController 有 extension | |
| func request(_ path: String, method: HttpMethod = .get, parameters: [String: Any]? = nil, localizedStatus: String? = NSLocalizedString("資料處理中", comment: "呼叫API讀取狀態文字"), _ completion: @escaping (_ json: JSON) -> Void) { | |
| // 顯示 ActivityIndicator | |
| if let status = localizedStatus { SVProgressHUD.show(withStatus: status) } | |
| // 待會使用 GCD 版本所以要 Dispatch 到其他 thread | |
| DispatchQueue.global().async { | |
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
| class AVC: UIViewController { | |
| weak var delegate: AVCDelegate? | |
| // TODO: implement | |
| func hello() { | |
| // 請 Main 幫忙做點事 | |
| self.delegate?.somethingFromA(self) | |
| } | |
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
| // | |
| // VideoViewController.swift | |
| // SideMenuCALayerDemo | |
| // | |
| // Created by 默司 on 2017/3/1. | |
| // Copyright © 2017年 默司. All rights reserved. | |
| // | |
| import UIKit | |
| import AVFoundation |
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
| .yt-live-chat-renderer-0 { | |
| background: transparent; | |
| } | |
| .yt-live-chat-renderer { | |
| height: 0; | |
| padding: 0; | |
| font-size: 0; | |
| } |
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
| var Home = { | |
| Box: function () { | |
| this.color = 'black'; | |
| this.paint = function (value, cb) { | |
| // delay 3 seconds. | |
| //var now = new Date().getTime(); | |
| //while (new Date().getTime() < now + 3000) { | |
| // /* do nothing */ | |
| //} | |
| this.color = value; |
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 | |
| extension UIView { | |
| @discardableResult func constraint(attribute attr1: NSLayoutAttribute, relatedBy: NSLayoutRelation = .equal, toItem: Any? = nil, attribute attr2: NSLayoutAttribute? = nil, multiplier: CGFloat = 1, constant: CGFloat = 0) -> NSLayoutConstraint { | |
| self.translatesAutoresizingMaskIntoConstraints = false | |
| let attr = attr2 ?? attr1 | |
| return NSLayoutConstraint(item: self, attribute: attr1, relatedBy: relatedBy, toItem: toItem, attribute: attr, multiplier: multiplier, constant: constant) |
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
| // | |
| // GalleryTools.h | |
| // Unity-iPhone | |
| // | |
| // Created by 默司 on 2017/5/9. | |
| // | |
| // | |
| #import <Foundation/Foundation.h> |
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
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.Threading; | |
| using UnityEngine; | |
| using UnityEngine.Networking; | |
| namespace Azure | |
| { | |
| public class Authentication |
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
| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Net; | |
| using System.Net.Security; | |
| using System.Security.Cryptography.X509Certificates; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| using UnityEngine; |