Banner Configuration Struct initialization - #2
Conversation
no change to the existing api, but added init(config: BannerConfiguration)
|
Hey Daltron, The configurations have two inits, one long one with all the properties (with some default values) and a builder init. //long init
let config = BannerConfiguration(color: UIColor.green, title: "Custom Notification from a struct", attributedTitle: nil, subtitle: "Extremely Customizable", attributedSubtitle: nil, leftView: nil, rightView: nil, customView: nil, bannerHeight: 100, duration: 2)
//builder
let config = BannerConfiguration(builder: { banner in
banner.color = UIColor.green
banner.title = "Custom notification from a struct"
banner.subtitle = "Extremely Customizable"
banner.bannerHeight = 100
banner.duration = 2
})I also did some reorganizing throughout the NotificationBanner subclasses and split out the adding of subviews and applying of constraints out into separate functions so that it would be easier to understand the set up when applying the BannerConfiguration. I didn't change any functionality there just moved stuff around. |
|
@ahartwel First off, thanks a lot for taking a stab at this. It looks like a lot of time was put into it and that is greatly appreciated. However, after carefully reviewing, I'm still not sure this is in NotificationBanner's best interest quite yet. It doesn't really seem to add any new significant functionality that NotificationBanner doesn't already have. I'd love to hear any opposition you may have. I encourage you to use your forked version if it truly suits your needs better. |
|
It didn't add any functionality but it allows users to customize the banner without needing to know about the internals of the banner. The best example of this is the duration and height. In master you have to read through the code to find out they are publicly modifiable. With a config object you get all the properties abstracted away from their implementation and you can set what you want and just ignore the inner workings of the banner. You don't need to read through any docs or code to know what you can do. |
|
@ahartwel I understand the point you are trying to bring across but I still don't think this configuration option makes setting the
or
|
No description provided.