Skip to content

Commit

Permalink
Remove ImplicitlyUnwrappedOptional to be compatible with Swift 5
Browse files Browse the repository at this point in the history
  • Loading branch information
PhamBaTho committed Nov 16, 2020
1 parent 03238b8 commit dbf4d38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Source/BTNavigationDropdownMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ open class BTNavigationDropdownMenu: UIView {
titleToDisplay = title
}

titleSize = (titleToDisplay as NSString).size(withAttributes: [NSAttributedString.Key.font:self.configuration.navigationBarTitleFont])
titleSize = (titleToDisplay as NSString).size(withAttributes: [NSAttributedString.Key.font: self.configuration.navigationBarTitleFont])

// Set frame
let frame = CGRect(x: 0, y: 0, width: titleSize.width + (self.configuration.arrowPadding + self.configuration.arrowImage.size.width)*2, height: self.navigationController!.navigationBar.frame.height)
Expand Down
14 changes: 5 additions & 9 deletions Source/Internal/BTConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class BTConfiguration {
var cellTextLabelColor: UIColor?
var selectedCellTextLabelColor: UIColor?
var cellTextLabelFont: UIFont!
var navigationBarTitleFont: UIFont!
var navigationBarTitleFont: UIFont
var cellTextLabelAlignment: NSTextAlignment!
var cellSelectionColor: UIColor?
var checkMarkImage: UIImage!
Expand All @@ -45,27 +45,23 @@ final class BTConfiguration {
var shouldChangeTitleText: Bool!

init() {
self.defaultValue()
}

func defaultValue() {
// Path for image
let bundle = Bundle(for: BTConfiguration.self)
let url = bundle.url(forResource: "BTNavigationDropdownMenu", withExtension: "bundle")
let imageBundle = Bundle(url: url!)
let checkMarkImagePath = imageBundle?.path(forResource: "checkmark_icon", ofType: "png")
let arrowImagePath = imageBundle?.path(forResource: "arrow_down_icon", ofType: "png")
// Default values

// Set default values
self.menuTitleColor = UIColor.darkGray
self.cellHeight = 50
self.cellBackgroundColor = UIColor.white
self.arrowTintColor = UIColor.white
self.cellSeparatorColor = UIColor.darkGray
self.cellTextLabelColor = UIColor.darkGray
self.selectedCellTextLabelColor = UIColor.darkGray
self.cellTextLabelFont = UIFont(name: "HelveticaNeue-Bold", size: 17)
self.navigationBarTitleFont = UIFont(name: "HelveticaNeue-Bold", size: 17)
self.cellTextLabelFont = UIFont.systemFont(ofSize: 17, weight: .bold)
self.navigationBarTitleFont = UIFont.systemFont(ofSize: 17, weight: .bold)
self.cellTextLabelAlignment = NSTextAlignment.left
self.cellSelectionColor = UIColor.lightGray
self.checkMarkImage = UIImage(contentsOfFile: checkMarkImagePath!)
Expand Down

0 comments on commit dbf4d38

Please sign in to comment.