Latest 0.1.0
Homepage https://github.com/sgr-ksmt/FirstAppearing
License MIT
Platforms ios 8.0, requires ARC

Helper Protocol-Extension for UIViewController’s viewWillAppear/viewDidAppear.

Carthage Compatible
Version
License
Platform

:tada:Features

  • Just once do process in viewWillAppear/viewDidAppear
  • Safety called. (If you use viewWillAppearOnce in viewDidLoad, this process will not be working.)

:pencil2:How to use

  • Adapt FirstAppearing protocol.
  • Use viewWillAppearOnce in viewWillAppear or
    Use viewDidAppearOnce in viewDidAppear.
class SomeViewController: UIViewControlelr, FirstAppearing {
    override func viewDidLoad() {
        super.viewDidLoad()
        viewWillAppearOnce() {
            print("Wahahaha!") // not working!!
        }
    }

    override func viewWillAppear(animated: Bool) {
        self.clearsSelectionOnViewWillAppear = self.splitViewController!.collapsed
        super.viewWillAppear(animated)
        viewWillAppearOnce() {
            // do something
            print("Once call,",__FUNTION__)
        }
    }

    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
        viewDidAppearOnce() {
            // do something
            print("Once call,",__FUNTION__)
        }
    }
}

Requirements

  • iOS 8.0+
  • Xcode 7.0+(Swift 2+)

Installation and Setup

With Carthage

  • Just add the following line to your Cartfile:
github "sgr-ksmt/FirstAppearing"
  • Run carthage update on Terminal.
  • Add the framework as described. Details: Carthage README

With CocoaPods

Just add the following line to your Podfile:

pod 'FirstAppearing'
  • Run pod install on Terminal.

Latest podspec

{
    "name": "FirstAppearing",
    "version": "0.1.0",
    "summary": "Helper Protocol-Extension for UIViewController's viewWillAppear/viewDidAppear.",
    "description": "Helper Protocol-Extension for UIViewController's "viewWillAppear/viewDidAppear" Written in Swift.",
    "homepage": "https://github.com/sgr-ksmt/FirstAppearing",
    "license": "MIT",
    "authors": "Suguru Kishimoto",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/sgr-ksmt/FirstAppearing.git",
        "tag": "0.1.0"
    },
    "source_files": "FirstAppearing/**/*.swift",
    "requires_arc": true
}

Pin It on Pinterest

Share This