DeviceHelper

public final class DeviceHelper : NSObject
extension DeviceHelper: MFMailComposeViewControllerDelegate

DeviceHelper is used to perform an user interaction. Such as sending an email or making a phone call.

Version

1.5.0

Date

17/08/2019
  • The delegate of the DeviceHelper.

    Declaration

    Swift

    public weak var delegate: DeviceHelperDelegate?
  • Open the system setting.

    Declaration

    Swift

    public func openSystemSetting()
  • Open a website.

    Declaration

    Swift

    public func openWebsite(withLink link: String)

    Parameters

    link

    The website address.

  • Make a phone call.

    Declaration

    Swift

    public func dialNumber(_ number: String)

    Parameters

    number

    The phone number.

  • Show a location in the map application. Please let the user confirm the action beforehand.

    Declaration

    Swift

    public func openMap(withAddress address: String)

    Parameters

    address

    The address to be shown.

  • Send an email. Please let the user confirm the action beforehand. The navigation controller should be apply if there is a view hierarchy.

    • Pparameters:
      • address: The email address.
      • subject: The subject of the email.
      • content: The content of the email.
      • isHTMLContent: Whether the content is a html or not.
      • attachments: A list of attachments of the email. It is a list of name and data pair

    Declaration

    Swift

    public func sendEmail(toAddress address: String,
                          withSubject subject: String,
                          withContent content: String,
                          withAttachments attachments: [String: Data] = [:],
                          asHTMLContent isHTML: Bool = false)
  • Initialize the object.

    Declaration

    Swift

    public init(application: UIApplication = UIApplication.shared)

    Parameters

    application

    The application used to make a function call.

  • Undocumented

    Declaration

    Swift

    public func mailComposeController(_ controller: MFMailComposeViewController,
                                      didFinishWith result: MFMailComposeResult,
                                      error: Error?)