forked from zufuliu/notepad4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSwift.swift
225 lines (206 loc) · 5.68 KB
/
Swift.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
// 5.10 https://www.swift.org/
// https://swift.org/documentation/
// https://github.com/apple/swift-evolution
//! keywords ===========================================================
// Keywords and Punctuation
// https://docs.swift.org/swift-book/documentation/the-swift-programming-language/lexicalstructure
// Keywords used in declarations
associatedtype
class
deinit
enum extension
fileprivate func
import init inout internal
let
open operator
private precedencegroup protocol public
rethrows
static struct subscript
typealias
var
// Keywords used in statements
break
case catch continue
default defer do
else
fallthrough for
guard
if in
repeat return
throw
switch
where while
// Keywords used in expressions and types
Any as await
catch
false
is
nil
rethrows
self Self super
throw throws
true try
// Keywords reserved in particular contexts
associativity
convenience
didSet dynamic
final
get
indirect infix
lazy left
mutating
none nonmutating
optional override
postfix precedence prefix Protocol
required right
set some
Type
unowned
weak willSet
macro package
// Asynchronous Functions and Methods
async
// Actor Declaration
actor nonisolated
//! directive ===========================================================
// Keywords that begin with a number sign
// Compiler Control Statements
// https://docs.swift.org/swift-book/documentation/the-swift-programming-language/statements#Compiler-Control-Statements
#if
#elseif
#else
#endif
#sourceLocation(file: file-path, line: line-number)
#sourceLocation()
#error(diagnostic-message)
#warning(diagnostic-message)
#available(availability-arguments)
#unavailable(availability-arguments)
// Literal Expression
// https://docs.swift.org/swift-book/documentation/the-swift-programming-language/expressions#Literal-Expression
// https://developer.apple.com/documentation/swift/macros
#file
#fileID
#filePath
#line
#column
#function
#externalMacro(module: String,type: String)
#dsohandle
// playground-literal
#colorLiteral(red: expression, green: expression, blue: expression, alpha: expression)
#fileLiteral(resourceName : expression)
#imageLiteral(resourceName : expression)
// Selector Expression
#selector(method name)
#selector(getter: property name)
#selector(setter: property name)
// Key-Path String Expression
#keyPath(property name)
//! attribute ===========================================================
// https://docs.swift.org/swift-book/documentation/the-swift-programming-language/attributes
// Declaration Attributes
@attached()
@available()
@backDeployed()
@discardableResult
@dynamicCallable
@dynamicMemberLookup
@freestanding()
@frozen
@GKInspectable
@inlinable
@main
@nonobjc
@NSCopying
@NSManaged
@objc
@objcMembers
@propertyWrapper
@resultBuilder
@requires_stored_property_inits
@testable
@unchecked
@usableFromInline
@warn_unqualified_access
// Type Attributes
@autoclosure
@convention
@escaping
@Sendable
// Switch Case Attributes
@unknown
//! library ===========================================================
// Swift Standard Library
// https://developer.apple.com/documentation/swift/swift-standard-library
// Numbers and Basic Values
@frozen struct Bool
@frozen struct Int
@frozen struct Double
@frozen struct Float
@frozen struct Range<Bound> where Bound : Comparable
@frozen struct ClosedRange<Bound> where Bound : Comparable
protocol Error
@frozen enum Result<Success, Failure> where Failure : Error
@frozen enum Optional<Wrapped>
@frozen struct UInt
@frozen struct UInt8
@frozen struct UInt16
@frozen struct UInt32
@frozen struct UInt64
@frozen struct Int8
@frozen struct Int16
@frozen struct Int32
@frozen struct Int64
@frozen struct Float16
typealias Float32 = Float
typealias Float64 = Double
@frozen struct SystemRandomNumberGenerator
protocol RandomNumberGenerator
func min<T>(_ x: T, _ y: T) -> T where T : Comparable
func max<T>(_ x: T, _ y: T) -> T where T : Comparable
func abs<T>(_ x: T) -> T where T : Comparable, T : SignedNumeric
// Strings and Text
@frozen struct String
@frozen struct Character
@frozen enum Unicode
@frozen struct StaticString
// Collections
@frozen struct Array<Element>
@frozen struct Dictionary<Key, Value> where Key : Hashable
@frozen struct Set<Element> where Element : Hashable
protocol OptionSet
protocol Sequence
protocol Collection
protocol MutableCollection where Self.SubSequence : MutableCollection
func stride<T>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> where T : Strideable
func repeatElement<T>(_ element: T, count n: Int) -> Repeated<T>
func sequence<T>(first: T, next: @escaping (T) -> T?) -> UnfoldFirstSequence<T>
func zip<Sequence1, Sequence2>(_ sequence1: Sequence1, _ sequence2: Sequence2) -> Zip2Sequence<Sequence1, Sequence2> where Sequence1 : Sequence, Sequence2 : Sequence
// Basic Behaviors
@frozen struct Slice<Base> where Base : Collection
protocol Equatable
protocol Comparable
protocol Identifiable
protocol Hashable
@frozen struct Hasher
// Input and Output
func print(_ items: Any..., separator: String = " ", terminator: String = "\n")
func readLine(strippingNewline: Bool = true) -> String?
@frozen enum CommandLine
protocol TextOutputStream
// Debugging and Reflection
func assert(_ condition: @autoclosure () -> Bool, _ message: @autoclosure () -> String = String(), file: StaticString = #file, line: UInt = #line)
func fatalError(_ message: @autoclosure () -> String = String(), file: StaticString = #file, line: UInt = #line) -> Never
struct Mirror
@frozen enum Never
func type<T, Metatype>(of value: T) -> Metatype
// Key-Path Expressions
class KeyPath<Root, Value> : PartialKeyPath<Root>
class PartialKeyPath<Root> : AnyKeyPath
class AnyKeyPath
class WritableKeyPath<Root, Value> : KeyPath<Root, Value>
// Type Casting and Existential Types
typealias AnyObject
typealias AnyClass = AnyObject.Type
typealias Void = ()