Latest 0.1.2
Homepage https://github.com/kutan74/UsabillaForm
License MIT
Platforms ios 12.1
Authors

Swift Package Manager

Mac + Linux

Welcome to UsabillaForm — a suite of class that aims to display feedback forms in your existing Swift projects.

Installation


pod 'UsabillaForm'

Examples

A form must be provided with a UsabillaForm object in order to be initialized


let form = UsabillaForm(formID: "yourFormId", type: .FeedBack)
let usabilla = Usabilla(form: form)
usabilla.delegate = self
usabilla.configureFeedBackForm { [weak self] result in
    switch result {
    case .success(let form):
        self?.present(form, animated: true, completion: nil)
    case .failure(let error):
        print(error.localizedDescription)
    }
}

Or rating view


let form = UsabillaForm(formID: "yourFormId", type: .Rating)
let usabilla = Usabilla(form: form)
usabilla.delegate = self
usabilla.configureFeedBackForm { [weak self] result in
    switch result {
    case .success(let form):
        self?.present(form, animated: true, completion: nil)
    case .failure(let error):
        print(error.localizedDescription)
    }
}

You can set custom properties such as form background color, form title color and form title font


form.customProperties?.formBackgroundColor = .white
form.customProperties?.formTitleFont = UIFont.systemFont(ofSize: 14, weight: .light)
form.customProperties?.formTitleTextColor = .black
form.customProperties?.feedBackQuestionTitle = "Your Feedback ?"

Comfort the UsabillaFormDelegate in your view controller


extension YourViewController: UsabillaFormDelegate {
    func didFormSubmit(_ form: UIViewController, _ typedText: String) {
    // form.dismiss(animated: true, completion: nil)
    }

    func didRatingSubmit(_ form: UIViewController, _ rating: Int) {
    // form.dismiss(animated: true, completion: nil)
    }
}

Surveys

let surveyQuestions = ["Question 1",
               "Question 2",
               "Question 3"]
let survey = UsabillaForm.Survey(surveyQuestions: surveyQuestions)

let form = UsabillaForm(formID: "yourFormId", 
            type: .Survey,
            survey: survey)

usabilla = Usabilla(form: form)
usabilla.delegate = self
usabilla.configureSurvey { [weak self] result in
    switch result {
    case .success(let form):
        self?.present(form, animated: true, completion: nil)
    case .failure(let error):
        print(error.localizedDescription)
     }
   }
}

Survey Delegate will return [String: Int]. Survey questions and their ratings


func didSurveySubmitted(_ form: UIViewController, _ surveyResult: [String : Int]) {
    form.dismiss(animated: true, completion: nil)   
}

Latest podspec

{
    "name": "UsabillaForm",
    "version": "0.1.2",
    "summary": "Making your feedback process easier",
    "description": "This CocoaPods library helps you to display feedback forms and user surveys easiliy.",
    "module_name": "Usabilla",
    "platforms": {
        "ios": "12.1"
    },
    "homepage": "https://github.com/kutan74/UsabillaForm",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Kutan u00c7u0131ngu0131su0131z": "[email protected]"
    },
    "source": {
        "git": "https://github.com/kutan74/UsabillaForm.git",
        "tag": "0.1.2"
    },
    "source_files": "Usabilla/**/*.{h,m,swift}",
    "swift_version": "5.0",
    "ios": {
        "frameworks": "UIKit"
    }
}

Pin It on Pinterest

Share This