NDT7 0.0.4

NDT7 0.0.4

Maintained by Miguel Nieto, Stephen Soltesz, Olga Galchenko.

NDT7 0.0.4

  • By
  • Miguel Nieto


branch travis-ci codacy sonarcloud codecov
develop Build Status Coverage Status
master Build Status Codacy Badge Quality Gate Coverage Status

Bugs Vulnerabilities Maintainability Reliability Security

Average time to resolve an issue Percentage of issues still open Measurement Lab Apache License Platform Carthage Compatible CocoaPods Compatible

Table of Contents


"Measure the Internet, save the data, and make it universally accessible and useful."

NDT7 provides a framework to measure the download and upload speed.

Current supported features

  • Download Speed Test
  • Upload Speed Test


  • iOS 10.0+ / macOS 10.14.0+ / appleTV 10.0+ / watchOS 3.0+
  • Xcode 10.2+
  • Swift 5.0+


Visit the NDT7 documentation for instructions and browsing api references.



CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website.

platform :ios, '10.0'

target 'NDT7 example' do
  pod 'NDT7', '0.0.4'

Then, run the following command:

$ pod install


Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

Create a Cartfile and add the following line:

github "m-lab/ndt7-client-ios" ~> 0.0.4

Next, run the following command:

$ carthage update

Check out the Carthage docs ยป for more info.

Manual Installation

Adding all swift files

Add all *.swift files from Sources directory into your project.

Embedded Framework

Step 1. Add as a git Submodule

Add NDT7 as a submodule to your local git repo with the following command:

$ git submodule add [email protected]:m-lab/ndt7-client-ios

Step 2. Drag NDT7.xcodeproj to your project

Drag the NDT7.xcodeproj into the Project Navigator of you application's Xcode project.

Step 3. Embed the framework

Under "General" tab from your project, add the NDT7 framework as an embedded binary. You'll see different frameworks depending if you need it for iOS, macOS or appleTV.

Setup and usage


If you experiment issues been blocked for App Transport Security during the M-Lab server discovery, that means that requires data to be transmitted securely and you need to tell iOS to make exceptions for you.

Remember, if you add this exception you'll be required to explain it to the app review team when you submit your app to the App Store.

The exception will be defined for the individual site locate.measurementlab.net inside your application's info.plist file. You can edit the plist as source code, right-click on your info.plist and choose Open As > Source Code.

Your plist should end like this:


Please, copy paste this before that:


That requests add an exception for site locate.measurementlab.net.

The only setup needed for debugging purpose is to enable logging if needed.

NDT7.loggingEnabled = true

If specific settings are needed for the testing configuration, you can define an NDT7Settings object, otherwise, use the default one with NDT7Settings().

In the next section, "Start speed test", we'll show all the steps needed to start a test.

Start speed test

The next example show the whole process for a download and upload speed test.

  1. Setup all the functions needed for NDT7Test delegate.
  2. Create the settings for testing. NDT7Settings.
  3. Create a NDT7Test object with NDT7Settings already created.
  4. Setup a delegation for NDT7Test to get the test information.
  5. Start speed test for download and/or upload.
import UIKit
import NDT7

class ViewController: UIViewController {

    var ndt7Test: NDT7Test?

    override func viewDidLoad() {
        // For debugging purpose you can enable logs for NDT7 framework.
        NDT7.loggingEnabled = true

    func startTest() {
        // 2. Create the settings for testing. NDT7Settings.
        let settings = NDT7Settings()
        // 3. Create a NDT7Test object with NDT7Settings already created.
        ndt7Test = NDT7Test(settings: settings)
        // 4. Setup a delegation for NDT7Test to get the test information.
        ndt7Test?.delegate = self
        // 5. Start speed test for download and/or upload.
        ndt7Test?.startTest(download: true, upload: true) { [weak self] (error) in
            guard self != nil else { return }
            if let error = error {
                print("NDT7 iOS Example app - Error during test: \(error.localizedDescription)")
            } else {
                print("NDT7 iOS Example app - Test finished.")

    func cancelTest() {

// 1. Setup all the functions needed for NDT7Test delegate.
extension ViewController: NDT7TestInteraction {

    func test(kind: NDT7TestConstants.Kind, running: Bool) {

    func measurement(origin: NDT7TestConstants.Origin, kind: NDT7TestConstants.Kind, measurement: NDT7Measurement) {

    func error(kind: NDT7TestConstants.Kind, error: NSError) {


NDT7 iOS client is released under the Apache License, Version 2.0. See LICENSE for details.