-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added AppBackground and applied to SearchView
- Loading branch information
Showing
7 changed files
with
83 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// AppBackground.swift | ||
// MyComics | ||
// | ||
// Created by Xavier Ramos on 24/4/24. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct AppBackground<Content: View>: View { | ||
|
||
let content: Content | ||
|
||
init(@ViewBuilder content: @escaping () -> Content) { | ||
self.content = content() | ||
} | ||
|
||
var body: some View { | ||
|
||
ZStack { | ||
|
||
Rectangle() | ||
.fill(LinearGradient(colors: [Colors.primary, Color.secondary], | ||
startPoint: .top, | ||
endPoint: .bottom)) | ||
.ignoresSafeArea() | ||
|
||
content | ||
} | ||
} | ||
} | ||
|
||
struct AppBackgroundModifier: ViewModifier { | ||
|
||
func body(content: Content) -> some View { | ||
|
||
AppBackground { | ||
|
||
content | ||
} | ||
} | ||
} | ||
|
||
extension View { | ||
|
||
func appBackground() -> some View { | ||
|
||
self.modifier(AppBackgroundModifier()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters