Skip to content

Commit

Permalink
Add support for largeTitleTextAttributes
Browse files Browse the repository at this point in the history
  • Loading branch information
barisatamer committed Jun 19, 2020
1 parent 49f38ce commit 84d1de1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ themeService.attrsStream
- barStyle
- barTintColor
- titleTextAttributes
- largeTitleTextAttributes

##### UIPageControl

Expand Down
8 changes: 8 additions & 0 deletions RxTheme/Classes/RxExtensions/UINavigationBar+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,13 @@ public extension Reactive where Base: UINavigationBar {
}
}

/// Bindable sink for `largeTitleTextAttributes` property
@available(iOS, introduced:11.0)
var largeTitleTextAttributes: Binder<[NSAttributedString.Key: Any]?> {
return Binder(self.base) { view, attr in
view.largeTitleTextAttributes = attr
}
}

}
#endif
13 changes: 13 additions & 0 deletions RxTheme/Classes/ThemeExtensions/UINavigationBar+Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,18 @@ public extension ThemeProxy where Base: UINavigationBar {
}
}

/// (set only) bind a stream to largeTitleTextAttributes
@available(iOS, introduced:11.0)
var largeTitleTextAttributes: Observable<[NSAttributedString.Key: Any]?> {
get { return .empty() }
set {
let disposable = newValue
.takeUntil(base.rx.deallocating)
.observeOn(MainScheduler.instance)
.bind(to: base.rx.largeTitleTextAttributes)
hold(disposable, for: "largeTitleTextAttributes")
}
}

}
#endif

0 comments on commit 84d1de1

Please sign in to comment.