NWIdentityBuilder

public class NWIdentityBuilder

Undocumented

  • // Set the email address

    Declaration

    Swift

    public func setEmail(email: String) -> NWIdentityBuilder

    Parameters

    email

    the String of the email address

    Return Value

    the Builder itself for chaining purposes

  • // Set the password

    Declaration

    Swift

    public func setPassword(password: String) -> NWIdentityBuilder

    Parameters

    password

    the password String (at least 1 character)

    Return Value

    the Builder itself for chaining purposes

  • // Set the product email params. This could be needed by the mail sender to have a customization of some of the parameter

    Declaration

    Swift

    public func setProductEmailParams(params: NWSimpleObject) -> NWIdentityBuilder

    Parameters

    params

    NWSimpleObject

    Return Value

    the Builder itself for chaining purposes

  • // Set the smsTemplate This method covers the French use case where a SMS must be sent towards a user that has correcly added an email identity

    Declaration

    Swift

    public func setSMSTemplate(smsTemplate: String) -> NWIdentityBuilder

    Parameters

    setSMSTemplate

    the setSMSTemplate String

    Return Value

    the Builder itself for chaining purposes

  • Set the global callback to be informed when the Identity flow built has finished

    Declaration

    Swift

    public func setOnFlowCompleteCallback(callback: @escaping FlowCompleteCallback) -> NWIdentityBuilder

    Parameters

    callback

    FlowCompleteCallback callback

    Return Value

    the Builder itself for chaining purposes

  • Build a Email Identity Flow object

    Example of Email Password Login flow:

       do {
            let builder = try Newton.getSharedInstance()
                .getIdentityManager()
                .getIdentityBuilder()
                .setEmail(email: "pippo@gmail.com")
                .setPassword(pin: "1234")
    
            let flow = try addEmailIdentityFlow()
        } catch NWError.NewtonNotInitialized(let reason) {
            print("Newton not initialized: \(reason)")
        } catch NWError.IdentityBuilderError(let reason) {
            print("Login builder Error: \(reason)")
        } catch {
            print("Unknown Error: \(error)")
        }
    

    Warning

    A check if there aren’t any other login flow in progress is made

    Warning

    The User must be not already logged in

    Throws

    IdentityBuilderError if IdentityFlow requirements are not met

    Precondition

    User must be logged in and the EMAIL and Password have been set

    Declaration

    Swift

    public func getAddEmailIdentityFlow() throws -> NWAddEmailIdentityFlow

    Return Value

    the EmailIdentityFlow object built