You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.8 KiB

6 years ago
  1. # BRYXBanner
  2. [![Version](https://img.shields.io/cocoapods/v/BRYXBanner.svg?style=flat)](http://cocoapods.org/pods/BRYXBanner)
  3. [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
  4. [![License](https://img.shields.io/cocoapods/l/BRYXBanner.svg?style=flat)](http://cocoapods.org/pods/BRYXBanner)
  5. [![Platform](https://img.shields.io/cocoapods/p/BRYXBanner.svg?style=flat)](http://cocoapods.org/pods/BRYXBanner)
  6. A lightweight dropdown banner for iOS 7+.
  7. ![Example](https://raw.githubusercontent.com/bryx-inc/BRYXBanner/master/Example/Demo.gif)
  8. ## Usage
  9. Import `BRYXBanner`
  10. ```rust
  11. import BRYXBanner
  12. ```
  13. Create a banner using the designated initializer.
  14. ```rust
  15. let banner = Banner(title: "Image Notification", subtitle: "Here's a great image notification.", image: UIImage(named: "Icon"), backgroundColor: UIColor(red:48.00/255.0, green:174.0/255.0, blue:51.5/255.0, alpha:1.000))
  16. banner.dismissesOnTap = true
  17. banner.show(duration: 3.0)
  18. ```
  19. If you want the banner to persist until you call `.dismiss()`, leave the argument out of the call to `.show()`
  20. To run the example project, clone the repo, and run `pod install` from the Example directory first.
  21. ## Requirements
  22. Demo project requires iOS 8, though BRYXBanner works on iOS 7+.
  23. ## Installation
  24. BRYXBanner is available through [CocoaPods](http://cocoapods.org) and [Carthage](https://github.com/Carthage/Carthage).
  25. #### Using CocoaPods
  26. To install it, simply add the following line to your Podfile:
  27. ```ruby
  28. pod 'BRYXBanner'
  29. ```
  30. If you need to support iOS 7, just copy `Banner.swift` into your Xcode project.
  31. #### Using Carthage
  32. Create a Cartfile in your project directory and add the following line.
  33. ```ruby
  34. github "bryx-inc/BRYXBanner"
  35. ```
  36. Run `carthage update` from the command line. This will build the framework. The framework will be within `Carthage/build/BRYXBanner.framework`.
  37. Add the framework to your project by going to your app's targets and selecting the General tab. Drag the built framework onto `Linked Frameworks and Libraries`
  38. Go to the Build Phases tab, click the `+` sign and add a new run script phase. Then add the following:
  39. ```
  40. /usr/local/bin/carthage copy-frameworks
  41. ```
  42. to the box under Shell. Finally click `+` to add a new input file. Replace the default with:
  43. ```
  44. $(SRCROOT)/Carthage/Build/iOS/BRYXBanner.framework
  45. ```
  46. Now build and run. You're all set! More information on Carthage is available [here](https://github.com/Carthage/Carthage).
  47. ## Documentation
  48. Docs are automatically generated and available [right here](http://cocoadocs.org/docsets/BRYXBanner/).
  49. ## Authors
  50. Harlan Haskins ([@harlanhaskins](https://github.com/harlanhaskins))
  51. Adam Binsz ([@adambinsz](https://github.com/adambinsz))
  52. ## License
  53. BRYXBanner is available under the MIT license. See the LICENSE file for more info.