Latest 0.1.0
Homepage https://github.com/JunichiT/Stay
License MIT
Platforms ios 10.0, requires ARC
Authors

Stay-Swift

A Library that Help Measure Screen Stay Duration of ViewController.

Installation

CocoaPods installation is supported.

use_framework!

pod "Stay"

Setup

Confirm to protocol

  • Confirms to ScreenStayMeasureable protocol to the VC you want to measure screen stay duration
import Stay

class FooViewController: UIViewController, ScreenStayMeasureable {
…
}

Set screenName

private(set) var screenName: String = "foo_screen"

Add a setup method

  • The simplest way:
    • Put setUpDefaultMeasurement() method to VC
      Note: setUpDefaultMeasurement() must be called before viewDidAppear of the UIViewController’s lifecycle

ex:

    override func viewDidLoad() {
        super.viewDidLoad()
        setUpDefaultMeasurement()
    }
  • If you want a fine control of the measurement, put following methods to the points you wants to start/stop measurement
    • startScreenStayTimer()
    • stopScreenStayTimer()

Get and handle screen stay duration

extension FooViewController: ScreenStayMeasureable {
        func didScreenStayTimerFinishMeasuring(screenStayDuration: Int64) {
            // Put your code here
            // e.g. Send screenStayDuration to logger
    }
}

Latest podspec

{
    "name": "Stay",
    "version": "0.1.0",
    "summary": "A Library that Help Measure Screen Stay Duration of ViewController.",
    "description": "This library helps measure screen stay duration of ViewController.",
    "homepage": "https://github.com/JunichiT/Stay",
    "license": "MIT",
    "authors": {
        "Junichi Tsurukawa": "[email protected]"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source": {
        "git": "https://github.com/JunichiT/Stay.git",
        "tag": "0.1.0"
    },
    "requires_arc": true,
    "swift_version": "4.0",
    "source_files": "Sources/*.{h,swift}"
}

Pin It on Pinterest

Share This