(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.
// Created by Baye Wayly on 2020/3/13. | |
// Copyright © 2020 Baye. All rights reserved. | |
import SwiftUI | |
struct Measure<Content: View>: View { | |
@State var cost: TimeInterval = 0 | |
var content: Content | |
init(@ViewBuilder builder: () -> Content) { |
# 你可以从该 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' |