File tree 3 files changed +3
-13
lines changed
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 {
13
13
@Binding private var isLoading : Bool
14
14
@State private var language = Defaults [ . language]
15
15
@Default ( . isDarkMode) var isDarkMode
16
- private var localizeTitleResource : StringResource ?
17
16
private var title : String ?
18
17
19
18
var content : ( ) -> Content
20
19
21
20
init ( isLoading: Binding < Bool > = . constant( false ) ,
22
- localizeTitleResource: StringResource ? = nil ,
23
21
title: String ? = nil ,
24
22
content: @escaping ( ) -> Content ) {
25
23
_isLoading = isLoading
26
- self . localizeTitleResource = localizeTitleResource
27
24
self . title = title
28
25
self . content = content
29
26
}
30
27
31
- private func getTitle( ) -> String {
32
- if let resource = localizeTitleResource {
33
- return String ( resource: resource, preferredLanguages: [ language] )
34
- }
35
- return title ?? " "
36
- }
37
-
38
28
var body : some View {
39
29
LoadingView ( isShowing: $isLoading) {
40
30
content ( )
41
31
}
42
- . navigationTitle ( getTitle ( ) )
32
+ . navigationTitle ( title ?? " " )
43
33
. background ( Color ( R . color. backgroundPrimary) )
44
34
. environment ( \. colorScheme, isDarkMode ? . dark : . light)
45
35
. preferredColorScheme ( isDarkMode ? . dark : . light)
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ struct TopMoviesScreen: View {
48
48
}
49
49
50
50
var body : some View {
51
- Screen ( isLoading: $output. isLoading, localizeTitleResource : R . string. localizable. movieWatchTitle) {
51
+ Screen ( isLoading: $output. isLoading, title : R . string. localizable. movieWatchTitle ( ) ) {
52
52
ScrollView ( showsIndicators: false ) {
53
53
VStack ( alignment: . leading, spacing: 16 ) {
54
54
if !output. data. upcoming. isEmpty {
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ struct TodosScreen: View {
19
19
private let toTodoItems = PublishRelay < TodoCategory > ( )
20
20
21
21
var body : some View {
22
- Screen ( localizeTitleResource : R . string. localizable. todoTitle) {
22
+ Screen ( title : R . string. localizable. todoTitle ( ) ) {
23
23
ZStack {
24
24
if output. todoLists. isEmpty {
25
25
emptyView ( )
You can’t perform that action at this time.
0 commit comments