Code Monkey home page Code Monkey logo

adnetpromoterscoresurvey-ios's Introduction

ADNetPromoterScoreSurvey

Build Status CocoaPods Version Swift Version Platform

ADNetPromoterScoreSurvey is an iOS component that presents Net Promoter Score (NPS) survey dialog to the user.

iPhone1 iPhone2 iPhone3

Features

  • Popup NPS survey dialog
  • Callbacks on user interaction
  • Final callback with user score, promoter type and feedback
  • Customize the dialog's UI with your own style.

Support and requirements

  • iOS 9 and higher
  • Swift 4
  • Supports iPhone X

Installation

Cocoapods (Version 1.4.0 or later)

pod 'ADNetPromoterScoreSurvey'

Getting started

Create ADNetPromoterScoreSurvey member

var npsSurvery = ADNetPromoterScoreSurvey()

Show The survey

Just call showSurvey function view controller whenever you want to show the survey:

self.npsSurvery.showSurvey(onViewController: self)

Delegate Methods

Implement NetPromoterScoreSurveyDelegate to get survey results and user interaction callbacks

self.npsSurvery.delegate = self

Implementing NetPromoterScoreSurveyDelegate protocol:

All delegate methods are optional:

@objc optional func netPromoterScoreViewDidChange(_ npsSurvey: ADNetPromoterScoreSurvey,
                                                       toView: NetPromoterScoreViewType)

Implement this method to receive a callback when survey view changed. toView will hold the active view type (scoreQuestionView, feedbackQuestionView, thankYouView)


@objc optional func netPromoterScoreDidPressSendScore(_ npsSurvey: ADNetPromoterScoreSurvey,
                                                    selectedScore: Int)

Implement this method to receive a callback when the user click on "Send" Button after selecting score in the Score Question View.


@objc optional func netPromoterScoreDidChangeScoreValue(_ npsSurvey: ADNetPromoterScoreSurvey,
                                                      newScoreValue: Int)

Implement this method to receive a callback when the user change the score in the Score slider.


@objc optional func netPromoterScoreDidPressEditScore(_ npsSurvey: ADNetPromoterScoreSurvey)

Implement this method to receive a callback when the user back to edit score from the "Feedback View"


@objc optional func netPromoterScoreSurveryCompleted(_ npsSurvey: ADNetPromoterScoreSurvey,
                                                    surveyResult: NPSResult)

Implement this method to receive a callback when the survey proccess completed and get the whole survey result. surveyResult parameter provides summary of the survey result (score, feedback, promoterType).


@objc optional func netPromoterScoreDidPressClose(_ npsSurvey: ADNetPromoterScoreSurvey,
                                                     fromView: NetPromoterScoreViewType)
                                                    

Implement this method to receive a callback when the user closes the survey. fromView will hold the view type that was active when the user closed the survey.

Custom Appearance

In order to use you custom texts and fonts you can change the appearnce of the survey.

Changing text:

self.npsSurvery.appearance.scoreQuestionViewAppearance.questionText = "My custom question text" 

Changing font:

self.npsSurvery.appearance.feedbackQuestionViewAppearance.textFieldFont = UIFont(name: "My Custom Font Name", size: 14)

Changing colors:

self.npsSurvery.appearance.scoreQuestionViewAppearance.highRankTitleColor = UIColor.red
self.npsSurvery.appearance.feedbackQuestionViewAppearance.titleFontColor = UIColor.red
self.npsSurvery.appearance.thankYouViewAppearance.backgroundColor  = UIColor.black

Example Project

  1. Clone the repository to your local environment
  2. Go to dir NetPromoterScoreSurveyExample
  3. Execute pod install
  4. Open Xcode workspace NetPromoterScoreSurveyExample.xcworkspace
  5. Run

Change Log

See Change Log page.

Contributing

See Contributing page.

Contact

Tomer Shalom

adnetpromoterscoresurvey-ios's People

Contributors

applitom avatar philippb avatar shaltom avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.