ErrorView 1.0.0

ErrorView 1.0.0

Maintained by Philip Bui.




ErrorView 1.0.0

  • By
  • Philip Bui

Error View

CI Status CodeCov Version Carthage Compatible Platform License

Error View appendable to View Controllers subviews.

  • Animated in and out effects.
  • Text shake effects.

Requirements

  • iOS 9.0+
  • Xcode 10.3+
  • Swift 4.2+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Error View into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'ErrorView'

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Error View into your Xcode project using Carthage, specify it in your Cartfile:

github "philip-bui/error-view"

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but Error View does support its use on supported platforms.

Once you have your Swift package set up, adding Error View as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/philip-bui/error-view.git", from: "1.0.0"))
]

Usage

import ErrorView

// AppDelegate.swift - Modify global defaults.
ErrorView.backgroundColor = UIColor.orange
ErrorView.font = UIFont.boldSystemFont(ofSize: 14.5)
ErrorView.textColor = UIFont.white

// ViewController.swift - Customize own error views
private weak var errorView: ErrorView?

private func textViewDidBeginEditing(_ textView: UITextView) {
	errorView?.dismiss()	
}

private func textViewDidEndEditing(_ textView: UITextView) {
	guard true else {
		errorView = ErrorView(addTo: self, text: "Invalid text")
		return
	}
}

License

Error View is available under the MIT license. See LICENSE for details.