Subscripts
The following subscripts are available globally.
-
Mechanica
Accesses the
String
associated with the given key for reading and writing. - Parameter key: The key to find. - Returns: The value associated withkey
ifkey
is in the dictionary otherwise,nil
.Declaration
Swift
public final subscript(key: Key<String>) -> String?
Parameters
key
The key to find.
Return Value
The value associated with
key
ifkey
is in the dictionary otherwise,nil
. -
Mechanica
Accesses the object value associated with the given key for reading and writing. - Parameter key: The key to find. - Returns: The value associated with
key
ifkey
is in the dictionary otherwise,nil
.Declaration
Swift
public final subscript(key: Key<Any>) -> Any?
Parameters
key
The key to find.
Return Value
The value associated with
key
ifkey
is in the dictionary otherwise,nil
. -
Mechanica
Accesses the
Flaoting-Point
value associated with the given key for reading and writing. - Parameter key: The key to find. - Returns: The value associated withkey
ifkey
is in the dictionary otherwise,nil
.Declaration
Swift
public final subscript(key: Key<Float>) -> Float?
Parameters
key
The key to find.
Return Value
The value associated with
key
ifkey
is in the dictionary otherwise,nil
. -
Mechanica
Accesses the
Data
value associated with the given key for reading and writing. - Parameter key: The key to find. - Returns: The value associated withkey
ifkey
is in the dictionary otherwise,nil
.Declaration
Swift
public final subscript(key: Key<Data>) -> Data?
Parameters
key
The key to find.
Return Value
The value associated with
key
ifkey
is in the dictionary otherwise,nil
. -
Mechanica
Accesses the
Bool
value associated with the given key for reading and writing. - Parameter key: The key to find. - Returns: The value associated withkey
ifkey
is in the dictionary otherwise,nil
.Declaration
Swift
public final subscript(key: Key<Bool>) -> Bool?
Parameters
key
The key to find.
Return Value
The value associated with
key
ifkey
is in the dictionary otherwise,nil
. -
Mechanica
Accesses the
Array
value associated with the given key for reading and writing. - Parameter key: The key to find. - Returns: The value associated withkey
ifkey
is in the dictionary otherwise,nil
.Declaration
Swift
public final subscript(key: Key<[Any]>) -> [Any]?
Parameters
key
The key to find.
Return Value
The value associated with
key
ifkey
is in the dictionary otherwise,nil
. -
Mechanica
Accesses the
Dictionary
[String:Any] value associated with the given key for reading and writing. - Parameter key: The key to find. - Returns: The value associated withkey
ifkey
is in the dictionary otherwise,nil
.Declaration
Swift
public final subscript(key: Key<[String: Any]>) -> [String: Any]?
Parameters
key
The key to find.
Return Value
The value associated with
key
ifkey
is in the dictionary otherwise,nil
. -
Mechanica
Accesses the
NSNumber
associated with the given key for reading and writing. - Parameter key: The key to find. - Returns: The value associated withkey
ifkey
is in the dictionary otherwise,nil
.Declaration
Swift
public final subscript(key: Key<NSNumber>) -> NSNumber?
Parameters
key
The key to find.
Return Value
The value associated with
key
ifkey
is in the dictionary otherwise,nil
. -
Mechanica
Accesses the
Double
value associated with the given key for reading and writing. - Parameter key: The key to find. - Returns: The value associated withkey
ifkey
is in the dictionary otherwise,nil
.Declaration
Swift
public final subscript(key: Key<Double>) -> Double?
Parameters
key
The key to find.
Return Value
The value associated with
key
ifkey
is in the dictionary otherwise,nil
. -
Mechanica
Accesses the
URL
instance associated with the given key for reading and writing. - Parameter key: The key to find. - Returns: The value associated withkey
ifkey
is in the dictionary otherwise,nil
.Declaration
Swift
public final subscript(key: Key<URL>) -> URL?
Parameters
key
The key to find.
Return Value
The value associated with
key
ifkey
is in the dictionary otherwise,nil
. -
Mechanica
Accesses the
Date
value associated with the given key for reading and writing. - Parameter key: The key to find. - Returns: The value associated withkey
ifkey
is in the dictionary otherwise,nil
.Declaration
Swift
public final subscript(key: Key<Date>) -> Date?
Parameters
key
The key to find.
Return Value
The value associated with
key
ifkey
is in the dictionary otherwise,nil
. -
Mechanica
Accesses the
Int
value associated with the given key for reading and writing. - Parameter key: The key to find. - Returns: The value associated withkey
ifkey
is in the dictionary otherwise,nil
.Declaration
Swift
public final subscript(key: Key<Int>) -> Int?
Parameters
key
The key to find.
Return Value
The value associated with
key
ifkey
is in the dictionary otherwise,nil
.
-
Mechanica*
Returns the substring in the given range.
Declaration
Swift
public subscript (range: Range<Int>) -> String?
Parameters
range
range
Return Value
Substring in range or nil.
-
Mechanica*
Returns the range of the first occurrence of a given string in the
String
.Declaration
Swift
public subscript (substring: String) -> Range<String.Index>?
Parameters
substring
substring
Return Value
range of the first occurrence or nil.
-
Mechanica*
Gets the character at the specified index as String.
Declaration
Swift
public subscript (index: Int) -> String?
Parameters
index
index Position of the character to get
Return Value
Character as String or nil if the index is out of bounds
-
Mechanica*
Returns the substring in the given
NSRange
Declaration
Swift
public subscript (range: NSRange) -> String?
Parameters
range
NSRange
Return Value
Substring in range or nil.