Skip to content

Commit bdd0461

Browse files
tgrapperonp4checo
authored andcommitted
Remove a few dependencies to UIKit in SwiftUI's CaseStudies (#1492)
* Remove a few dependencies to UIKit in SwiftUI's CaseStudies * Update Examples/CaseStudies/SwiftUICaseStudies/02-Effects-Basics.swift * Update Examples/CaseStudies/SwiftUICaseStudies/02-Effects-Cancellation.swift Co-authored-by: Brandon Williams <[email protected]> (cherry picked from commit f220051aaaea7fcbbca081742614e64f048811e5) # Conflicts: # Examples/CaseStudies/SwiftUICaseStudies/00-Core.swift
1 parent b59d281 commit bdd0461

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

Examples/CaseStudies/SwiftUICaseStudies/00-Core.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import ComposableArchitecture
22
import ReactiveSwift
3-
import UIKit
43
import XCTestDynamicOverlay
54

65
struct Root: ReducerProtocol {

Examples/CaseStudies/SwiftUICaseStudies/02-Effects-Basics.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct EffectsBasics: ReducerProtocol {
9494

9595
struct EffectsBasicsView: View {
9696
let store: StoreOf<EffectsBasics>
97+
@Environment(\.openURL) var openURL
9798

9899
var body: some View {
99100
WithViewStore(self.store, observe: { $0 }) { viewStore in
@@ -139,7 +140,7 @@ struct EffectsBasicsView: View {
139140

140141
Section {
141142
Button("Number facts provided by numbersapi.com") {
142-
UIApplication.shared.open(URL(string: "http://numbersapi.com")!)
143+
self.openURL(URL(string: "http://numbersapi.com")!)
143144
}
144145
.foregroundStyle(.secondary)
145146
.frame(maxWidth: .infinity)

Examples/CaseStudies/SwiftUICaseStudies/02-Effects-Cancellation.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ struct EffectsCancellation: ReducerProtocol {
7070

7171
struct EffectsCancellationView: View {
7272
let store: StoreOf<EffectsCancellation>
73-
73+
@Environment(\.openURL) var openURL
74+
7475
var body: some View {
7576
WithViewStore(self.store, observe: { $0 }) { viewStore in
7677
Form {
@@ -105,7 +106,7 @@ struct EffectsCancellationView: View {
105106

106107
Section {
107108
Button("Number facts provided by numbersapi.com") {
108-
UIApplication.shared.open(URL(string: "http://numbersapi.com")!)
109+
self.openURL(URL(string: "http://numbersapi.com")!)
109110
}
110111
.foregroundStyle(.secondary)
111112
.frame(maxWidth: .infinity)

Examples/CaseStudies/SwiftUICaseStudies/03-Navigation-NavigateAndLoad.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import Combine
22
import ComposableArchitecture
33
import ReactiveSwift
44
import SwiftUI
5-
import UIKit
65

76
private let readMe = """
87
This screen demonstrates navigation that depends on loading optional state.

0 commit comments

Comments
 (0)