- Array 是 value type,使用 structs 实现
- 数据类型没有隐式转换
- 对于 String,count() 的复杂度是 O(n),每一个 Character 都是 unicode scalars 的序列
- raw values 和 associated values 的区别
- 如果必要,对于实现了 _ObjectiveCBridgeable 的 value types 会被自动桥接成 reference types
- 讲一下 unowned 和 weak 的区别
- 改 struct 的属性的方法名前要加 mutating,但如果这个 struct 用 let 声明的,改不了。修正:网友指出用 nonmutating set 也可以改属性。
- nil 和 .None 的区别
- capture list in closure
- 举一个 guard ... where 的例子
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 | |
import PlaygroundSupport | |
let chartData: [Double] = [1, 2, 4, 0, 0, 2, 6, 0, 4, 8, 12, 14, 1, 2, 2, 0, 0, 1, 6, 0, 4, 0, 3, 0] | |
class TimelineCandleChart: UIView { | |
var data: [Double] = [] { | |
didSet { setNeedsDisplay() } | |
} |
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
// | |
// RxTextFieldDelegateProxy.swift | |
// | |
// Created by Lex Tang on 2/14/18. | |
// Copyright © 2018 Krunoslav Zaher. All rights reserved. | |
// | |
import RxSwift | |
import RxCocoa |
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
#!/bin/bash | |
PLISTBUDDY="/usr/libexec/PlistBuddy" | |
INFO_PLIST="$CODESIGNING_FOLDER_PATH/Info.plist" | |
SETTINGS_PLIST="$CODESIGNING_FOLDER_PATH/Settings.bundle/Root.plist" | |
VERSION_NUMBER="`$PLISTBUDDY -c \"Print CFBundleShortVersionString\" \"$INFO_PLIST\"`" | |
BUILD_NUMBER="`$PLISTBUDDY -c \"Print CFBundleVersion\" \"$INFO_PLIST\"`" | |
VERSION="Version $VERSION_NUMBER ($BUILD_NUMBER)" | |
GROUP_INDEX="`xmllint --xpath \"count(//array/dict)-1\" \"$SETTINGS_PLIST\"`" | |
$PLISTBUDDY -c "Set :PreferenceSpecifiers:$GROUP_INDEX:Title '$VERSION'" "$SETTINGS_PLIST" |
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 | |
enum CollectionOperator: String { | |
case avg | |
case count | |
case max | |
case min | |
case sum |
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
# | |
# https://roelant.net/2015/share-your-vpn-mac-el-capitan.html | |
sleep 15 | |
# | |
/usr/sbin/sysctl -w net.inet.ip.fw.enable=1 | |
/usr/sbin/sysctl -w net.inet.ip.forwarding=1 | |
/usr/sbin/sysctl -w net.inet6.ip6.forwarding=1 | |
pfctl -d | |
pfctl -f /Users/lex/Dropbox/openvpn/pf.conf -e |
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
// | |
// BackgroundHint.m | |
// Zus | |
// | |
// Created by Lex on 4/13/16. | |
// Copyright © 2016 lex.sh. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <UIKit/UIKit.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
luaSetWaxConfig({openBindOCFunction="true"}) | |
waxClass{"Zus.SettingVC"} | |
function viewDidLoad(self) | |
print("lua viewDidLoad"); | |
self:ORIGviewDidLoad(); | |
self:setTitle("Wax-patched " .. wax.appVersion) | |
end |
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
// | |
// UIWindow+FLEX.swift | |
// | |
// Created by Lex on 11/6/15. | |
// Copyright © 2015 lexrus.com. All rights reserved. | |
// | |
import UIKit | |
#if DEBUG |
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
changelog({ | |
"cmn-Hans" => "感谢使用 VPN On!为改善用户使用体验,我们每隔一周就会在 App Store 更新应用。你可以前往手机“设置”>“iTunes 与 App Store”>“自动下载的项目”,打开“更新”。\n\nVPN On 应用的每次更新都会改进速度和稳定性。一有新功能推出,我们会在应用中提示你。", | |
"cmn-Hant" => "感謝使用 VPN On!爲改善用戶使用體驗,我們每隔一週就會在 App Store 更新應用。你可以前往手機“設置”>“iTunes 與 App Store”>“自動下載的項目”,打開“更新”。\n\nVPN On 應用的每次更新都會改進速度和穩定性。一有新功能推出,我們會在應用中提示你。", | |
"ja-JP" => "VPN Onをご利用いただきありがとうございます。VPN Onではアプリをより快適にご利用いただくため、アプリストアで隔週でアップデートを行っております。[設定] > [iTunes & App Store] > [自動ダウンロード]でアップデートをオンにすることで、自動的に(このページにアクセスすることなく)アプリをアップデートいただけます。 \n\nVPN Onアプリのアップデートではスピードと信頼性の向上が行われており、また新しい機能が追加されると、アプリ内でその機能がハイライトされます。", | |
"it-IT" => "Grazie di usare VPN On! Per migliorare la nostra applicazione, pubblichiamo aggiornamenti nell'App Store ogni 2 settimane. Puoi aggiornare l'applicazione automaticamente (senza dover tornare qui) accedendo a Impostazioni > iTunes Store e App Store > Download automatici e attivando Aggiornamenti. \n\nOgni aggiornamento della nostra applicazione VPN On presenta miglioramenti relativi a velocità e aff |