Comments (5)
I guess I think this would be simpler as an extension with static functions on Banner
Like:
extension Banner {
class func warning(text: String) {
return Banner(title: "Warning", subtitle: text, image: UIImage(named: "Caution"), backgroundColor: UIColor.bryxYellowColor())
}
}
from bryxbanner.
Hmm, that's a fair point @harlanhaskins . I hadn't even considered that. It probably would be easier. I like the idea of being able to pass around BannerTemplateType
objects though. For instance, an ErrorType
enum could conform to BannerTemplateType
so you could show the right error message for any given error.
This also allows me to pass a BannerTemplateType
into a function to display the banner at run-time, when I may not know what banner I want to use at compile time.
Chances are using an extension, I could always get the same functionality, but I feel like it would create cleaner code in many situations using a protocol, and much more flexible.
Additionally, a user can easily create extensions as you have above on their own right now if they need them, so adding the protocol does not stop you from doing so.
Thoughts?
from bryxbanner.
@harlanhaskins If you aren't interested in this feature, just let me know and we can close this.
Using extensions is something that users can probably just implement on their own very easily, so I don't think we need to add anything to the library in that case.
I still think that have a protocol for this would be really helpful, and I'm willing to take the time to make a PR, but I understand if this is a feature you aren't interested in including.
from bryxbanner.
Yeah, I'm just not really convinced it's worth the extra coverage in the library. The Banner API is fairly simple on purpose.
Thanks for the proposal though!
from bryxbanner.
You got it. Thanks
from bryxbanner.
Related Issues (20)
- MinimumHeight not work on with Bottom appear HOT 6
- Where is sound of notification? HOT 1
- Xcode 10 and Swift 4.2 HOT 9
- Lack of 'swift_version' in podspec file HOT 4
- Installation via Swift Package Manager
- Multiple Toast show at a Single time HOT 2
- Deployment Target is set to 8.0
- Is there any user data that is either being collected or Tracked by the BRYXBanner
- BRYXBanner/BRYXBanner-Swift.h file not found HOT 1
- CheeriosBanner
- Not respecting top safe area HOT 1
- status bar doesn't restore it's original style when dismissing banner manually HOT 1
- Support for sub views , adding Buttons and actions to the sub views would be great.
- Cannot be used in Objective-C project.
- Setting TextColor makes icon appear black HOT 1
- open url in didTapBlock HOT 1
- swift 4 error HOT 1
- Banner doesn't appears on IOs 11 HOT 4
- Issue when building last version 0.8.0 HOT 1
- iPhone X: bottom banner is overlapping with home indicator HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bryxbanner.