-
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.
Browse files
Browse the repository at this point in the history
[홈] 웹 뷰 기본 세팅
- Loading branch information
Showing
9 changed files
with
176 additions
and
48 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
36 changes: 36 additions & 0 deletions
36
Projects/Features/Sources/KeymeTests/KeymeTests/KeymeTestsFeature.swift
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,36 @@ | ||
// | ||
// KeymeTestsFeature.swift | ||
// Features | ||
// | ||
// Created by 김영인 on 2023/08/17. | ||
// Copyright © 2023 team.humanwave. All rights reserved. | ||
// | ||
|
||
import ComposableArchitecture | ||
import Foundation | ||
|
||
public struct KeymeTestsFeature: Reducer { | ||
|
||
public struct State: Equatable { | ||
let url: String | ||
|
||
public init(url: String) { | ||
self.url = url | ||
} | ||
} | ||
|
||
public enum Action { | ||
case transition | ||
} | ||
|
||
public init() { } | ||
|
||
public var body: some Reducer<State, Action> { | ||
Reduce { state, action in | ||
switch action { | ||
case .transition: | ||
return .none | ||
} | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
Projects/Features/Sources/KeymeTests/KeymeTests/KeymeTestsView.swift
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,30 @@ | ||
// | ||
// KeymeTestsView.swift | ||
// Features | ||
// | ||
// Created by 김영인 on 2023/08/17. | ||
// Copyright © 2023 team.humanwave. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
import ComposableArchitecture | ||
|
||
import DSKit | ||
|
||
public struct KeymeTestsView: View { | ||
let store: StoreOf<KeymeTestsFeature> | ||
|
||
public init(store: StoreOf<KeymeTestsFeature>) { | ||
self.store = store | ||
} | ||
|
||
public var body: some View { | ||
WithViewStore(store, observe: { $0 }) { viewStore in | ||
ZStack { | ||
KeymeWebView(url: viewStore.url) | ||
} | ||
.frame(maxWidth: .infinity, maxHeight: .infinity) | ||
} | ||
} | ||
} |
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
45 changes: 45 additions & 0 deletions
45
Projects/Features/Sources/KeymeTests/KeymeWeb/KeymeWebView.swift
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,45 @@ | ||
// | ||
// KeymeWebView.swift | ||
// Features | ||
// | ||
// Created by 김영인 on 2023/08/17. | ||
// Copyright © 2023 team.humanwave. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
import WebKit | ||
|
||
public struct KeymeWebView: UIViewRepresentable { | ||
public let url: String | ||
|
||
init(url: String) { | ||
self.url = url | ||
} | ||
|
||
public func makeUIView(context: Context) -> WKWebView { | ||
let webView = WKWebView(frame: CGRect.zero, configuration: WKWebViewConfiguration()) | ||
webView.backgroundColor = .init(white: 1, alpha: 0.3) | ||
|
||
if let url = URL(string: url) { | ||
webView.load(URLRequest(url: url)) | ||
} | ||
|
||
return webView | ||
} | ||
|
||
public func updateUIView(_ uiView: WKWebView, context: Context) { | ||
|
||
} | ||
|
||
public func makeCoordinator() -> Coordinator { | ||
Coordinator(parent: self) | ||
} | ||
|
||
public class Coordinator: NSObject { | ||
let parent: KeymeWebView | ||
|
||
init(parent: KeymeWebView) { | ||
self.parent = parent | ||
} | ||
} | ||
} |
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