EXTENSION

String

extension String: Masking

Properties

masked

public var masked: String

maskedPrefix

var maskedPrefix: String

Returns a String by displaying the last 10 characters.

Methods

optionalData(_:encoding:fallback:)

static func optionalData(_ data: Data?, encoding: Encoding = .utf8, fallback: String = "") -> String

Returns a String based on an optional Data and an encoding value. If the data is nil or it is no possible to convert the Data to a valid String, then the fallback is returned.

Parameters

Name Description
data An optional Data to transform into a String.
encoding The encoding to transform the data into a String. The default value is .utf8.