-
Notifications
You must be signed in to change notification settings - Fork 0
[#12] WKWebView에 해당하는 Representable을 구현한다 #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fdb3127
feat: SKWebView 구현
indextrown 75b2a98
test: 테스트코드 추가
indextrown 0845d02
ci: coderabbit 리뷰 허용
indextrown 1dad0ce
fix: UIColor -> Color로 파라미터 타입 변경
indextrown 3ca273f
ci: 이메일 알림 비활성화
indextrown b2a65fc
test: UIColor -> Color로 파라미터 타입 변경에 따라 테스트 코드 수정
indextrown 437c7bc
fix: url 타입을 String -> URL로 수정
indextrown 5fdb0a4
fix: refreshTitle -> refreshText 변경
indextrown 1a160be
fix: 주석 수정
indextrown File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
File renamed without changes.
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ import SwiftUI | |
| struct SampleApp: App { | ||
| var body: some Scene { | ||
| WindowGroup { | ||
| ContentView() | ||
| TabBarView() | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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,33 @@ | ||
| // | ||
| // TabBarView.swift | ||
| // SampleApp | ||
| // | ||
| // Created by 김동현 on 4/8/26. | ||
| // | ||
|
|
||
| import SwiftUI | ||
| import SwiftUI_Kit | ||
|
|
||
| struct TabBarView: View { | ||
| @State private var selectedTab: Int = 0 | ||
| var body: some View { | ||
| TabView(selection: $selectedTab) { | ||
| WrapperListView() | ||
| .tabItem { | ||
| Label("Wrapper", systemImage: "0.square.fill") | ||
| } | ||
| .tag(0) | ||
|
|
||
| NativeListView() | ||
| .tabItem { | ||
| Label("Native", systemImage: "1.square.fill") | ||
| } | ||
| .tag(1) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #Preview { | ||
| TabBarView() | ||
| } | ||
|
|
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
Examples/SampleApp/SampleApp/View/Native/0. NativeListView/NativeListView.swift
This file contains hidden or 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,18 @@ | ||
| // | ||
| // NativeListView.swift | ||
| // SampleApp | ||
| // | ||
| // Created by 김동현 on 4/8/26. | ||
| // | ||
|
|
||
| import SwiftUI | ||
|
|
||
| struct NativeListView: View { | ||
| var body: some View { | ||
| Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) | ||
| } | ||
| } | ||
|
|
||
| #Preview { | ||
| NativeListView() | ||
| } |
27 changes: 27 additions & 0 deletions
27
Examples/SampleApp/SampleApp/View/Wrapper/0. WrapperListView/WrapperListView.swift
This file contains hidden or 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,27 @@ | ||
| // | ||
| // WrapperListView.swift | ||
| // SampleApp | ||
| // | ||
| // Created by 김동현 on 4/8/26. | ||
| // | ||
|
|
||
| import SwiftUI | ||
|
|
||
| struct WrapperListView: View { | ||
| var body: some View { | ||
| NavigationStack { | ||
| List { | ||
| Section("") { | ||
| NavigationLink("SKWebView") { | ||
| SampleSKWebView() | ||
| .toolbar(.hidden, for: .tabBar) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #Preview { | ||
| WrapperListView() | ||
| } |
25 changes: 25 additions & 0 deletions
25
Examples/SampleApp/SampleApp/View/Wrapper/1. SKWebView/SampleSKWebView.swift
This file contains hidden or 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,25 @@ | ||
| // | ||
| // SampleSKWebView.swift | ||
| // SampleApp | ||
| // | ||
| // Created by 김동현 on 4/8/26. | ||
| // | ||
|
|
||
| import SwiftUI | ||
| import SwiftUI_Kit | ||
|
|
||
| struct SampleSKWebView: View { | ||
| var body: some View { | ||
| SKWebView(url: URL(string: "https://www.naver.com")!) | ||
| .refreshable() | ||
| .refreshText("새로고침") | ||
| .refreshIndicatorColor(.blue) | ||
| .refreshTextColor(.blue) | ||
| .refreshIndicatorScale(1.0) | ||
| .ignoresSafeArea() | ||
| } | ||
| } | ||
|
|
||
| #Preview { | ||
| SampleSKWebView() | ||
| } |
This file was deleted.
Oops, something went wrong.
110 changes: 110 additions & 0 deletions
110
Sources/SwiftUI-Kit/Wrapper/SKWebView/SKWebView+Modifier.swift
This file contains hidden or 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,110 @@ | ||
| // | ||
| // SKWebView+Modifier.swift | ||
| // SwiftUI-Kit | ||
| // | ||
| // Created by 김동현 on 4/8/26. | ||
| // | ||
|
|
||
| import SwiftUI | ||
|
|
||
| // MARK: - Modifier | ||
| public extension SKWebView { | ||
|
|
||
| /// Pull to Refresh 기능을 활성화합니다. | ||
| /// | ||
| /// - Returns: 설정이 반영된 `SKWebView` | ||
| /// | ||
| /// 기본적으로 비활성화되어 있으며, 호출 시 활성화됩니다. | ||
| /// | ||
| /// ## Example | ||
| /// ```swift | ||
| /// SKWebView(url: url) | ||
| /// .refreshable() | ||
| /// ``` | ||
| func refreshable() -> Self { | ||
| var copy = self | ||
| copy.isRefreshEnabled = true | ||
| return copy | ||
| } | ||
|
|
||
| /// Pull to Refresh 시 표시할 텍스트를 설정합니다. | ||
| /// | ||
| /// - Parameter text: 새로고침 시 상단에 표시될 문자열 | ||
| /// - Returns: 설정이 반영된 `SKWebView` | ||
| /// | ||
| /// ## Example | ||
| /// ```swift | ||
| /// SKWebView(url: url) | ||
| /// .refreshable() | ||
| /// .refreshText("새로고침 중...") | ||
| /// ``` | ||
| /// | ||
| /// - Note: 이 설정은 `refreshable()`이 활성화된 경우에만 적용됩니다. | ||
| func refreshText(_ text: String) -> Self { | ||
| var copy = self | ||
| copy.refreshText = text | ||
| return copy | ||
| } | ||
|
|
||
| /// Pull to Refresh 텍스트의 색상을 설정합니다. | ||
| /// | ||
| /// - Parameter color: 텍스트에 적용할 색상 | ||
| /// - Returns: 설정이 반영된 `SKWebView` | ||
| /// | ||
| /// 기본값은 `.label`이며 시스템 다크/라이트 모드에 자동 대응됩니다. | ||
| /// | ||
| /// ## Example | ||
| /// ```swift | ||
| /// SKWebView(url: url) | ||
| /// .refreshable() | ||
| /// .refreshTextColor(.blue) | ||
| /// ``` | ||
| /// | ||
| /// - Note: 이 설정은 `refreshable()`이 활성화된 경우에만 적용됩니다. | ||
| func refreshTextColor(_ color: Color) -> Self { | ||
| var copy = self | ||
| copy.refreshTextColor = UIColor(color) | ||
| return copy | ||
| } | ||
|
|
||
| /// Pull to Refresh 인디케이터의 색상을 설정합니다. | ||
| /// | ||
| /// - Parameter color: 인디케이터에 적용할 색상 | ||
| /// - Returns: 설정이 반영된 `SKWebView` | ||
| /// | ||
| /// iOS의 `tintColor`에 해당하는 값입니다. | ||
| /// | ||
| /// ## Example | ||
| /// ```swift | ||
| /// SKWebView(url: url) | ||
| /// .refreshable() | ||
| /// .refreshIndicatorColor(.blue) | ||
| /// ``` | ||
| /// | ||
| /// - Note: 이 설정은 `refreshable()`이 활성화된 경우에만 적용됩니다. | ||
| func refreshIndicatorColor(_ color: Color) -> Self { | ||
| var copy = self | ||
| copy.refreshIndicatorColor = UIColor(color) | ||
| return copy | ||
| } | ||
|
|
||
| /// Pull to Refresh 인디케이터의 크기를 설정합니다. | ||
| /// | ||
| /// - Parameter scale: 인디케이터의 스케일 값입니다. 기본값은 `0.7`입니다. | ||
| /// - Returns: 설정이 반영된 `SKWebView` | ||
| /// | ||
| /// ## Example | ||
| /// ```swift | ||
| /// SKWebView(url: url) | ||
| /// .refreshable() | ||
| /// .refreshIndicatorScale(1.0) | ||
| /// ``` | ||
| /// | ||
| /// - Note: 이 설정은 `refreshable()`이 활성화된 경우에만 적용됩니다. | ||
| /// `CGAffineTransform`을 사용하여 크기를 조정합니다. | ||
| func refreshIndicatorScale(_ scale: CGFloat) -> Self { | ||
| var copy = self | ||
| copy.refreshIndicatorScale = scale | ||
| return copy | ||
|
indextrown marked this conversation as resolved.
|
||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.