Latest 0.1.1
Homepage https://github.com/james201311/Questionnaire
License MIT
Platforms ios 8.0
Frameworks UIKit
Authors

CI Status
Version
License
Platform

Questionnaire provide an easy way to present yes/no questionnaire or quizzes.

Example

Questionnaire

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

ios 9+

Installation

Questionnaire is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'Questionnaire'

Use: Swift

To use Questionnaire in swift,

  1. import Questionnaire

  2. inherite your controller from QuestionaireController

  3. override following three methods:
    func questionaire( questionaire: QuestionaireView, didClosedAt questionIndex: Int, answers: [Bool], closedButton: UIButton),
    func questionaire( questionaire: QuestionaireView, didFinishedAt questionIndex: Int, answers: [Bool])
    func questionaire(
    questionaire: QuestionaireView) -> [String]

  4. present the questionnaire view controller you just created!
import UIKit
import Questionnaire
class TestingQuestionnaireController: QuestionaireController{

    let questions = ["Are lizards small?",
                     "Are apples red fruit?",
                     "Are muscles needed to move our body?",
                     "Are scoops of ice cream sweet?",]

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    //MARK: - QuestionaireViewDelegate
    override func questionaire(_ questionaire: QuestionaireView, didClosedAt questionIndex: Int, answers: [Bool], _ closedButton: UIButton) {
        self.dismiss(animated: true){
            //To-Do: save answers somewhere
            print(answers)
        }
    }

    override func questionaire(_ questionaire: QuestionaireView, didFinishedAt questionIndex: Int, answers: [Bool]) {
        self.dismiss(animated: true){
            //To-Do: save answers somewhere
            print(answers)
        }
    }

    //MARK: - QuestionaireViewDataSource
    override func questionaire(_ questionaire: QuestionaireView) -> [String] {
        return questions
    }
}

Author

james201311, [email protected]

License

Questionnaire is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Questionnaire",
    "version": "0.1.1",
    "swift_version": "4.0",
    "summary": "Questionnaire provide easy yes/no Questionnaire view controller",
    "description": "Questionnaire provide easy yes/no Questionnaire view controller.",
    "homepage": "https://github.com/james201311/Questionnaire",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "james201311": "[email protected]"
    },
    "source": {
        "git": "https://github.com/james201311/Questionnaire.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "Questionnaire/Classes/**/*",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This