(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| # 你可以从该 URL 下载这个配置文件: http://surge.run/config-example/ios.conf | |
| # 用编辑器编辑后,再通过 iTunes, URL, AirDrop 或者 iCloud Drive 复制回 iOS 设备 | |
| # Version 2.0 | |
| [General] | |
| # 日志等级: warning, notify, info, verbose (默认值: notify) | |
| loglevel = notify | |
| # 跳过某个域名或者 IP 段,这些目标主机将不会由 Surge Proxy 处理。(在 macOS | |
| # 版本中,如果启用了 Set as System Proxy, 那么这些值会被写入到系统网络代理 | |
| # 设置中.) |
| # You can download this config from: http://surge.run/config-example/ios.conf | |
| # Edit with your computer and copy back to iOS device via iTunes, URL, AirDrop | |
| # or iCloud Drive | |
| # Version 2.0 | |
| [General] | |
| # Log level: warning, notify, info, verbose (Default: notify) | |
| loglevel = notify | |
| # Skip domain or IP range. These hosts will not be processed by Surge Proxy. | |
| # (In macOS version when Set as System Proxy enabled, these hosts will be |
| // Variables just contain an integer. We can have a maximum of `Int.max` variables in our program. ¯\_(ツ)_/¯ | |
| private struct Var { | |
| static var freshVarIx = 0 | |
| let ix: Int | |
| init() { | |
| Var.freshVarIx+=1 | |
| ix = Var.freshVarIx | |
| } | |
| } |
| ``` | |
| import Foundation | |
| import FLAnimatedImage | |
| import SDWebImage | |
| import Kingfisher | |
| /* | |
| Add this repo(https://github.com/rs/SDWebImage) to your project | |
| */ | |
| extension FLAnimatedImageView { |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import re | |
| from subprocess import Popen, PIPE | |
| from subprocess import call | |
| p = Popen(["xcrun","simctl","list","devices"], stdin=PIPE, stdout=PIPE, stderr=PIPE) | |
| output, err = p.communicate(b"input data that is passed to subprocess' stdin") |
| import Cocoa | |
| struct Person { | |
| var name: String = "John" | |
| var age: Int = 50 | |
| var dutch: Bool = false | |
| var address: Address? = Address(street: "Market St.") | |
| } | |
| struct Address { |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
Is AppKit causing you frustration? Instead of just complaining about it, lets try to make it better by compiling a list of specific problems with AppKit. Leave a comment below, and I'll include it in the list.
##NSView##
NSView does not have the ability to set an affine transform (rdar://15608609)NSTextField) do not respond properly when layer-backed. Take NSButton as an example. When not layer-backed, it will animate properly using the animator proxy. When layer-backed, using the animator proxy breaks focus rings (they jump to destination immediately). Currently, directly manipulating the layer of a cell-based control is not supported (and will lead to a broken interface), but is much needed. (rdar://15608822)##NSViewController##
NSViewController could be more useful. It has -loadView but no other lifecycle methods. (rdar://15608948)| # example view implements a simple dragging for mouse events. | |
| Wall.DevView = Ember.View.extend | |
| mouseDown: (ev) -> | |
| ev.dispatcher.lock @, 'mouseMove', 'mouseUp' | |
| @_mouseDown = @$().offset() | |
| @_mouseDown.pageX = ev.pageX | |
| @_mouseDown.pageY = ev.pageY | |
| @_mouseDown.dispatcher = ev.dispatcher | |
| console.log 'mouseDown' |
| #!/bin/sh | |
| # Create a RAM disk with same perms as mountpoint | |
| # Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions | |
| # Usage: sudo ./xcode_ramdisk.sh start | |
| USERNAME=$(logname) | |
| TMP_DIR="/private/tmp" | |
| RUN_DIR="/var/run" | |
| SYS_CACHES_DIR="/Library/Caches" |