Skip to content

A simple way to implement a Feedback System from the bottom of a ViewController informing the user of any changes within the app or some action they need to do. It's built onto the KeyWindow and hence above all ViewControllers, TableViewControllers or CollectionViewControllers.

mhlangagc/Feedback-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

Feedback System

An easy to implement custom pop up similar to Pinterest's Feedback System.

Feedback-System

Overview:

This library will help easily set up any Feedback System that appears from the bottom of the screen to inform the user of any actions/changes that could have taken place in the app.

Requirements :

  • Swift 4.0
  • XCode 9 (Beta-5)

Platform iOS Swift 4.0 compatible MIT

How to Setup:

Drag and drop the FeedbackView.swift file from the downloaded Project into your Swift 4 Project. Simple and Easy.

How to Use:

Real easy implemenation:

Add these lines to your the view controller (Collection and Table View Controllers also work) you want to show the FeedbackView in. This will initialise the FeedbackView to get access to the necessary function.

internal lazy var feedback: FeedbackView = {
	let feedback = FeedbackView()
	return feedback
}()

Showing the FeedbackView.

Just below the lines above or anywhere else withing your View Controller add the function below.

func showFeedback() {
	if let window = UIApplication.shared.keyWindow {
		self.feedback.showFeedback(backgroundColor: UIColor(red: 248.0/255.0, green:  231.0/255.0 ,blue: 28.0/255.0, alpha: 1.0), feedbackLabel: "Hello there", feedbackLabelColor: UIColor(red: 106.0/255.0, green:  99.0/255.0 ,blue: 13.0/255.0, alpha: 1.0), feedbackIconImage: #imageLiteral(resourceName: "haha"), feedbackIconImageTint: UIColor(red: 106.0/255.0, green:  99.0/255.0 ,blue: 13.0/255.0, alpha: 1.0), durationOnScreen: 3.8, currentView: window, showsBackgroundGradient: true, isAboveTabBar: false)
	}
}

In this function we get access the the keyWindow and use it’s frame to call the showFeedback function located in the FeedbackView.swift file.


Customisation

internal func showFeedback(backgroundColor: UIColor, feedbackLabel: String, feedbackLabelColor: UIColor, feedbackIconImage: UIImage, feedbackIconImageTint: UIColor, durationOnScreen: Double, currentView: UIView, showsBackgroundGradient: Bool, isAboveTabBar: Bool)

In calling the showFeedback function you can change the following parameter values:

  • The Background Color of the FeedbackView using the backgroundColor parameter. This takes a UIColor.
  • The Label in the FeedbackView using the feedbackLabel parameter. IMPORTANT : Keep this to about 5 words so it fits properly into the FeedbackView.
  • The Label Text Color using the feedbackLabelColor parameter. This take a UIColor.
  • The Icon in the FeedbackView using the feedbackIconImage parameter. IMPORTANT : This will be a 24 x 24pt sized image.
  • The Icon Tint Color using the feedbackIconImageTint parameter. This take a UIColor.
  • How long the FeedbackView is on the screen using the durationOnScreen parameter. This takes a Double that represents the time in seconds.
  • The Current View parameter should ALWAYS be set to window so it appears above every other view on screen.
  • The FeedbackView comes with a white background gradient to ensure the View shows up with better clarity over the views it appears over. The pinterest pop up has something similar if you take a closer look. If you don’t want the gradient to appear, set showsBackgroundGradient parameter to false.
  • If your view has a Tab Bar, set the isAboveTabBar parameter to true to show the FeedbackView above the Tab Bar. Otherwise this will appear just over the tab bar and may look unpleasant.

About

A simple way to implement a Feedback System from the bottom of a ViewController informing the user of any changes within the app or some action they need to do. It's built onto the KeyWindow and hence above all ViewControllers, TableViewControllers or CollectionViewControllers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages