Swift Package Index


A Dynu.com IP Update API wrapper.


  • The latest stable release is 3.0.0. Released 3 days ago.
  • The last commit to main was 3 days ago.

Swift Version Compatibility

  • 3.0.0 and main
    5.3
    5.2
    5.1
    5.0
    4.2
Full build results

Platform Compatibility

  • 3.0.0 and main
    iOS
    macOS(Intel)
    macOS(ARM)
    Linux
    tvOS
    watchOS
Full build results

DynuREST

A Dynu.com IP Update API wrapper.

Face it... a REST API that responds in only text doesn't feel very modern. DynuREST translates the text responses from the Dynu.com IP Update API into propery HTTP status codes and meaningful errors.

Installation

DynuREST is distributed using the Swift Package Manager. To install it into a project, add it as a dependency within your Package.swift manifest:

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/richardpiazza/DynuREST.git", from: "3.0.0")
    ],
    ...
)

Then import the DynuREST packages wherever you'd like to use it:

import DynuREST

Usage

The API class provides two default implementations: shared & insecure. They target the https and http schemes respectively.

Setting authentication information is done using the HTTP.Authorization enum:

let username: String = ""
let password: String = ""
API.shared.authorization = .basic(username: username, password: password)

The update() function will execute the query and parse the ResponseCode returned.

API.shared.update(ip: "127.0.0.1") { (statusCode, headers, data, error) in
    guard error == nil else {
        // Process Error
        return
    }

    guard statusCode < 300 else {
        // Non-OK response
        return
    }

    // All good
}

Insecure Use

The previous version of the api.dynu.com SSL Certificate did not work with iOS11.0+ and macOS10.13+. In order to use an insecure connection, your app must explicitly bypass App Transport Security in your Info.plist.

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>api.dynu.com</key>
        <dict>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>