This file contains 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
public struct ContiguousArray<Element>: _DestructorSafeContainer { | |
internal typealias _Buffer = _ContiguousArrayBuffer<Element> | |
internal var _buffer: _Buffer | |
internal init(_buffer: _Buffer) { | |
self._buffer = _buffer | |
} | |
} | |
extension ContiguousArray: RandomAccessCollection, MutableCollection { |
This file contains 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 | |
/// A class that keeps a weakly reference for `self` when implementing `onXXX` behaviors. | |
/// Instead of remembering to keep `self` as weak in a stored closure: | |
/// | |
/// ```swift | |
/// // MyClass.swift | |
/// var onDone: (() -> Void)? | |
/// func done() { | |
/// onDone?() |
This file contains 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
{# 找到所有实现了 DictionaryConvertible 的类型 #} | |
{% for t in types.implementing.DictionaryConvertible %} | |
{# 为该类型 t 创建 extension #} | |
extension {{ t.name }} { | |
var value: [String: Any] { | |
return [ | |
{# 对类型中的所有存储属性迭代 #} | |
{% for val in t.storedVariables %} | |
{% if val.isArray %} {# 如果变量是数组,map 其中的值进行嵌套 #} | |
"{{val.name}}": {{val.name}}.map { $0.value } |
This file contains 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
{% for enum in types.implementing.EnumSet|enum %} |
This file contains 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
{% for enum in types.implementing.EnumSet|enum %} | |
extension {{ enum.name }} { | |
{% if not enum.hasAssociatedValues %} | |
static let all: [{{ enum.name }}] = [ | |
{% for case in enum.cases %} .{{ case.name }}{% if not forloop.last %},{% endif %} | |
{% endfor %}] | |
{% endif %} | |
static let count: Int = {{ enum.cases.count }} | |
} | |
{% endfor %} |
This file contains 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 | |
var a = 123 | |
var cpa = a | |
class Miao {} | |
var c = Miao() | |
var cc = c | |
struct S {} | |
var s = S() |
This file contains 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
command script import "~/Library/Application Support/Realm/rlm_lldb.py" --allow-reload | |
command script import /usr/local/opt/chisel/libexec/fblldb.py | |
command alias -H "Print description in ObjC context" -h "Print in ObjC" -- cpo expression -l objc -O -- | |
command alias -H "Print description in Swift context" -h "Print in Swift" -- spo expression -l swift -O -- | |
command alias -H "Print value in ObjC context in hexadecimal" -h "Print in hex" -- cpx expression -f x -l objc -- | |
settings set target.x86-disassembly-flavor intel | |
settings set target.skip-prologue false |
This file contains 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.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Controller : MonoBehaviour { | |
UniWebView webView; | |
// Use this for initialization | |
void Start () { |
This file contains 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 status: OSStatus | |
let readOrWrite = kAudioFileGlobalInfo_ReadableTypes | |
var propertySize: UInt32 = 0 | |
status = AudioFileGetGlobalInfoSize(readOrWrite, | |
0, | |
nil, | |
&propertySize) | |
print(status) | |
print(propertySize) | |
This file contains 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 QuartzCore | |
var a = 1 | |
func methodParams(file: String = #file, fun: String = #function, line: UInt = #line) -> Int { | |
a += 1 | |
return a | |
} | |
func method() -> Int { | |
a += 1 |