File tree Expand file tree Collapse file tree 3 files changed +3
-13
lines changed
Expand file tree Collapse file tree 3 files changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -13,33 +13,23 @@ struct Screen<Content>: View where Content: View {
1313 @Binding private var isLoading : Bool
1414 @State private var language = Defaults [ . language]
1515 @Default ( . isDarkMode) var isDarkMode
16- private var localizeTitleResource : StringResource ?
1716 private var title : String ?
1817
1918 var content : ( ) -> Content
2019
2120 init ( isLoading: Binding < Bool > = . constant( false ) ,
22- localizeTitleResource: StringResource ? = nil ,
2321 title: String ? = nil ,
2422 content: @escaping ( ) -> Content ) {
2523 _isLoading = isLoading
26- self . localizeTitleResource = localizeTitleResource
2724 self . title = title
2825 self . content = content
2926 }
3027
31- private func getTitle( ) -> String {
32- if let resource = localizeTitleResource {
33- return String ( resource: resource, preferredLanguages: [ language] )
34- }
35- return title ?? " "
36- }
37-
3828 var body : some View {
3929 LoadingView ( isShowing: $isLoading) {
4030 content ( )
4131 }
42- . navigationTitle ( getTitle ( ) )
32+ . navigationTitle ( title ?? " " )
4333 . background ( Color ( R . color. backgroundPrimary) )
4434 . environment ( \. colorScheme, isDarkMode ? . dark : . light)
4535 . preferredColorScheme ( isDarkMode ? . dark : . light)
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ struct TopMoviesScreen: View {
4848 }
4949
5050 var body : some View {
51- Screen ( isLoading: $output. isLoading, localizeTitleResource : R . string. localizable. movieWatchTitle) {
51+ Screen ( isLoading: $output. isLoading, title : R . string. localizable. movieWatchTitle ( ) ) {
5252 ScrollView ( showsIndicators: false ) {
5353 VStack ( alignment: . leading, spacing: 16 ) {
5454 if !output. data. upcoming. isEmpty {
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ struct TodosScreen: View {
1919 private let toTodoItems = PublishRelay < TodoCategory > ( )
2020
2121 var body : some View {
22- Screen ( localizeTitleResource : R . string. localizable. todoTitle) {
22+ Screen ( title : R . string. localizable. todoTitle ( ) ) {
2323 ZStack {
2424 if output. todoLists. isEmpty {
2525 emptyView ( )
You can’t perform that action at this time.
0 commit comments