Functions

The following functions are available globally.

  • Infix operator for testing if a string matches a regular expression.

    Example

    let sentence = "The world is flat."
    if sentence =~ "^The" {
        // The sentence starts with "The"
    }
    

    Declaration

    Swift

    public func =~ (input: String, pattern: String) -> Bool

    Parameters

    input

    The string that should be tested.

    pattern

    The regular expression that should be used for testing.

  • Infix operator for testing if a string matches a regular expression.

    Example

    let pattern = RegularExpression("^The")!
    let sentence = "The world is flat."
    if sentence =~ pattern {
        // The sentence starts with "The"
    }
    

    Declaration

    Swift

    public func =~ (input: String, pattern: RegularExpression) -> Bool

    Parameters

    input

    The string that should be tested.

    pattern

    The regular expression that should be used for testing.

  • The function that actually handles TLS reading. This has to be a static function, therefore a paired stream is stored inside the connection reference in order to be able to read data from it.

    Declaration

    Swift

    private func tlsRead(
    	connectionPtr: SSLConnectionRef,
    	dataPtr: UnsafeMutableRawPointer,
    	dataLengthPtr: UnsafeMutablePointer<Int>
    ) -> OSStatus

    Parameters

    connectionPtr

    A pointer to the paired stream, from which data should be read and decrypted.

    dataPtr

    A pointer to a byte array, where the decrypted data should be stored.

    dataLengthPtr

    A pointer to an integer, where the amount of read bytes is stored.

    Return Value

    A status, as defined by the secure transport library.

  • A function that actually handles TLS writing. This has to be a static function, therefore a paired stream is stored inside the connection reference in order to be able to write data to it.

    Declaration

    Swift

    private func tlsWrite(
    	connectionPtr: SSLConnectionRef,
    	dataPtr: UnsafeRawPointer,
    	dataLengthPtr: UnsafeMutablePointer<Int>
    ) -> OSStatus

    Parameters

    connectionPtr

    A pointer to the paired stream, to which data should be encrypted and written.

    dataPtr

    A pointer to the byte array containing the data which should be written.

    dataLengthPtr

    A pointer to an integer containing the maximum amount of bytes, that should be written. The number is replaced with the amount of bytes actually written.

    Return Value

    A status, as defined by the secure transport library.