@@ -238,8 +238,29 @@ open class BTNavigationDropdownMenu: UIView {
238238 fatalError ( " init(coder:) has not been implemented " )
239239 }
240240
241+
242+ /// Legacy init converted as a convenience initializer to call the default init
243+ ///
244+ /// - Parameters:
245+ /// - navigationController: navigation Controller
246+ /// - containerView: container view
247+ /// - title: raw title to display
248+ /// - items: items to select
249+ public convenience init ( navigationController: UINavigationController ? = nil , containerView: UIView = UIApplication . shared. keyWindow!, title: String , items: [ String ] ) {
250+
251+ self . init ( navigationController: navigationController, containerView: containerView, title: BTTitle . title ( title) , items: items)
252+
253+ }
254+
255+
256+ /// Default init. This will allow the user to define a raw title or a index where the user can pre-define the index that is selected. This is specially handy for when it's necessary to restore from a saved state
257+ ///
258+ /// - Parameters:
259+ /// - navigationController: navigation controllre
260+ /// - containerView: container view
261+ /// - title: enum with the title to display
262+ /// - items: items to select
241263 public init ( navigationController: UINavigationController ? = nil , containerView: UIView = UIApplication . shared. keyWindow!, title: BTTitle , items: [ String ] ) {
242- //public init(navigationController: UINavigationController? = nil, containerView: UIView = UIApplication.shared.keyWindow!, title: String, items: [String], defaultIndex: Int? = nil) {
243264 // Key window
244265 guard let window = UIApplication . shared. keyWindow else {
245266 super. init ( frame: CGRect . zero)
@@ -268,14 +289,6 @@ open class BTNavigationDropdownMenu: UIView {
268289 titleToDisplay = title
269290 }
270291
271-
272- /*if let index = defaultIndex, index < items.count{
273- titleToDisplay = items[index]
274- } else {
275- //titleSize = (title as NSString).size(attributes: [NSFontAttributeName:self.configuration.navigationBarTitleFont])
276- titleToDisplay = title
277- }*/
278-
279292 titleSize = ( titleToDisplay as NSString ) . size ( attributes: [ NSFontAttributeName: self . configuration. navigationBarTitleFont] )
280293
281294 // Set frame
0 commit comments