Skip to content

Commit 67b41fa

Browse files
authored
Deprecate Introspect module (#272)
1 parent 5da8f12 commit 67b41fa

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Changelog
33

44
## master
55

6+
### SwiftUIIntrospect
7+
68
- Added: window introspection (#269)
79
- Added: `.sheet` introspection (#268)
810
- Added: `.fullScreenCover` introspection (#268)
@@ -12,6 +14,10 @@ Changelog
1214
- Added: `View` introspection on macOS (#266)
1315
- Improved: `View` introspection accuracy (#266)
1416

17+
### Introspect
18+
19+
This module is now deprecated (#272) and will be removed later this year (whenever iOS/tvOS 17 come out).
20+
1521
## [0.6.3]
1622

1723
### SwiftUIIntrospect

Introspect/ViewExtensions.swift

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ extension View {
1414

1515
#if canImport(UIKit)
1616
extension View {
17-
17+
1818
/// Finds a `TargetView` from a `SwiftUI.View`
19+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
1920
public func introspect<TargetView: UIView>(
2021
selector: @escaping (IntrospectionUIView) -> TargetView?,
2122
customize: @escaping (TargetView) -> ()
@@ -25,8 +26,9 @@ extension View {
2526
customize: customize
2627
))
2728
}
28-
29+
2930
/// Finds a `UINavigationController` from any view embedded in a `SwiftUI.NavigationView`.
31+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
3032
public func introspectNavigationController(customize: @escaping (UINavigationController) -> ()) -> some View {
3133
inject(UIKitIntrospectionViewController(
3234
selector: { introspectionViewController in
@@ -44,6 +46,7 @@ extension View {
4446
}
4547

4648
/// Finds a `UISplitViewController` from a `SwiftUI.NavigationView` with style `DoubleColumnNavigationViewStyle`.
49+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
4750
public func introspectSplitViewController(customize: @escaping (UISplitViewController) -> ()) -> some View {
4851
inject(UIKitIntrospectionViewController(
4952
selector: { introspectionViewController in
@@ -61,6 +64,7 @@ extension View {
6164
}
6265

6366
/// Finds the containing `UIViewController` of a SwiftUI view.
67+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
6468
public func introspectViewController(customize: @escaping (UIViewController) -> ()) -> some View {
6569
inject(UIKitIntrospectionViewController(
6670
selector: { $0.parent },
@@ -69,6 +73,7 @@ extension View {
6973
}
7074

7175
/// Finds a `UITabBarController` from any SwiftUI view embedded in a `SwiftUI.TabView`
76+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
7277
public func introspectTabBarController(customize: @escaping (UITabBarController) -> ()) -> some View {
7378
inject(UIKitIntrospectionViewController(
7479
selector: { introspectionViewController in
@@ -88,6 +93,7 @@ extension View {
8893
/// Finds a `UISearchController` from a `SwiftUI.View` with a `.searchable` modifier
8994
@available(iOS 15, *)
9095
@available(tvOS, unavailable)
96+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
9197
public func introspectSearchController(customize: @escaping (UISearchController) -> ()) -> some View {
9298
introspectNavigationController { navigationController in
9399
let navigationBar = navigationController.navigationBar
@@ -98,26 +104,31 @@ extension View {
98104
}
99105

100106
/// Finds a `UITableView` from a `SwiftUI.List`, or `SwiftUI.List` child.
107+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
101108
public func introspectTableView(customize: @escaping (UITableView) -> ()) -> some View {
102109
introspect(selector: TargetViewSelector.ancestorOrSiblingContaining, customize: customize)
103110
}
104111

105112
/// Finds a `UITableViewCell` from a `SwiftUI.List`, or `SwiftUI.List` child. You can attach this directly to the element inside the list.
113+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
106114
public func introspectTableViewCell(customize: @escaping (UITableViewCell) -> ()) -> some View {
107115
introspect(selector: TargetViewSelector.ancestorOrSiblingContaining, customize: customize)
108116
}
109117

110118
/// Finds a `UICollectionView` from a `SwiftUI.List`, or `SwiftUI.List` child.
119+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
111120
public func introspectCollectionView(customize: @escaping (UICollectionView) -> ()) -> some View {
112121
introspect(selector: TargetViewSelector.ancestorOrSiblingContaining, customize: customize)
113122
}
114123

115124
/// Finds a `UICollectionView` from a `SwiftUI.List`, or `SwiftUI.List` child. You can attach this directly to the element inside the list.
125+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
116126
public func introspectCollectionViewCell(customize: @escaping (UICollectionViewCell) -> ()) -> some View {
117127
introspect(selector: TargetViewSelector.ancestorOrSiblingContaining, customize: customize)
118128
}
119129

120130
/// Finds a `UIScrollView` from a `SwiftUI.ScrollView`, or `SwiftUI.ScrollView` child.
131+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
121132
public func introspectScrollView(customize: @escaping (UIScrollView) -> ()) -> some View {
122133
if #available(iOS 14, tvOS 14, *) {
123134
return introspect(selector: TargetViewSelector.siblingOrAncestorOrSiblingContainingOrAncestorChild, customize: customize)
@@ -130,6 +141,7 @@ extension View {
130141
///
131142
/// Customize is called with a `UICollectionView` wrapper, and the horizontal `UIScrollView`.
132143
@available(iOS 14, tvOS 14, *)
144+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
133145
public func introspectPagedTabView(customize: @escaping (UICollectionView, UIScrollView) -> ()) -> some View {
134146
if #available(iOS 16, *) {
135147
return introspect(selector: TargetViewSelector.ancestorOrSiblingContaining, customize: { (collectionView: UICollectionView) in
@@ -148,40 +160,47 @@ extension View {
148160
}
149161

150162
/// Finds a `UITextField` from a `SwiftUI.TextField`
163+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
151164
public func introspectTextField(customize: @escaping (UITextField) -> ()) -> some View {
152165
introspect(selector: TargetViewSelector.siblingContainingOrAncestorOrAncestorChild, customize: customize)
153166
}
154167

155168
/// Finds a `UITextView` from a `SwiftUI.TextEditor`
169+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
156170
public func introspectTextView(customize: @escaping (UITextView) -> ()) -> some View {
157171
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
158172
}
159173

160174
/// Finds a `UISwitch` from a `SwiftUI.Toggle`
161175
@available(tvOS, unavailable)
176+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
162177
public func introspectSwitch(customize: @escaping (UISwitch) -> ()) -> some View {
163178
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
164179
}
165180

166181
/// Finds a `UISlider` from a `SwiftUI.Slider`
167182
@available(tvOS, unavailable)
183+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
168184
public func introspectSlider(customize: @escaping (UISlider) -> ()) -> some View {
169185
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
170186
}
171187

172188
/// Finds a `UIStepper` from a `SwiftUI.Stepper`
173189
@available(tvOS, unavailable)
190+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
174191
public func introspectStepper(customize: @escaping (UIStepper) -> ()) -> some View {
175192
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
176193
}
177194

178195
/// Finds a `UIDatePicker` from a `SwiftUI.DatePicker`
179196
@available(tvOS, unavailable)
197+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
180198
public func introspectDatePicker(customize: @escaping (UIDatePicker) -> ()) -> some View {
181199
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
182200
}
183201

184202
/// Finds a `UISegmentedControl` from a `SwiftUI.Picker` with style `SegmentedPickerStyle`
203+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
185204
public func introspectSegmentedControl(customize: @escaping (UISegmentedControl) -> ()) -> some View {
186205
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
187206
}
@@ -190,6 +209,7 @@ extension View {
190209
#if os(iOS)
191210
@available(iOS 14, *)
192211
@available(tvOS, unavailable)
212+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
193213
public func introspectColorWell(customize: @escaping (UIColorWell) -> ()) -> some View {
194214
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
195215
}
@@ -201,6 +221,7 @@ extension View {
201221
extension View {
202222

203223
/// Finds a `TargetView` from a `SwiftUI.View`
224+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
204225
public func introspect<TargetView: NSView>(
205226
selector: @escaping (IntrospectionNSView) -> TargetView?,
206227
customize: @escaping (TargetView) -> ()
@@ -212,21 +233,25 @@ extension View {
212233
}
213234

214235
/// Finds a `NSSplitViewController` from a `SwiftUI.NavigationView` with style `DoubleColumnNavigationViewStyle`.
236+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
215237
public func introspectSplitView(customize: @escaping (NSSplitView) -> ()) -> some View {
216238
return introspect(selector: TargetViewSelector.ancestorOrSiblingContaining, customize: customize)
217239
}
218240

219241
/// Finds a `NSTableView` from a `SwiftUI.List`, or `SwiftUI.List` child.
242+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
220243
public func introspectTableView(customize: @escaping (NSTableView) -> ()) -> some View {
221244
introspect(selector: TargetViewSelector.ancestorOrSiblingContaining, customize: customize)
222245
}
223246

224247
/// Finds a `NSTableCellView` from a `SwiftUI.List`, or `SwiftUI.List` child. You can attach this directly to the element inside the list.
248+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
225249
public func introspectTableViewCell(customize: @escaping (NSTableCellView) -> ()) -> some View {
226250
introspect(selector: TargetViewSelector.ancestorOrSiblingContaining, customize: customize)
227251
}
228252

229253
/// Finds a `NSScrollView` from a `SwiftUI.ScrollView`, or `SwiftUI.ScrollView` child.
254+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
230255
public func introspectScrollView(customize: @escaping (NSScrollView) -> ()) -> some View {
231256
if #available(macOS 11, *) {
232257
return introspect(selector: TargetViewSelector.siblingOrAncestorOrSiblingContainingOrAncestorChild, customize: customize)
@@ -236,47 +261,56 @@ extension View {
236261
}
237262

238263
/// Finds a `NSTextField` from a `SwiftUI.TextField`
264+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
239265
public func introspectTextField(customize: @escaping (NSTextField) -> ()) -> some View {
240266
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
241267
}
242268

243269
/// Finds a `NSTextView` from a `SwiftUI.TextView`
270+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
244271
public func introspectTextView(customize: @escaping (NSTextView) -> ()) -> some View {
245272
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
246273
}
247274

248275
/// Finds a `NSSlider` from a `SwiftUI.Slider`
276+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
249277
public func introspectSlider(customize: @escaping (NSSlider) -> ()) -> some View {
250278
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
251279
}
252280

253281
/// Finds a `NSStepper` from a `SwiftUI.Stepper`
282+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
254283
public func introspectStepper(customize: @escaping (NSStepper) -> ()) -> some View {
255284
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
256285
}
257286

258287
/// Finds a `NSDatePicker` from a `SwiftUI.DatePicker`
288+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
259289
public func introspectDatePicker(customize: @escaping (NSDatePicker) -> ()) -> some View {
260290
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
261291
}
262292

263293
/// Finds a `NSSegmentedControl` from a `SwiftUI.Picker` with style `SegmentedPickerStyle`
294+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
264295
public func introspectSegmentedControl(customize: @escaping (NSSegmentedControl) -> ()) -> some View {
265296
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
266297
}
267298

268299
/// Finds a `NSTabView` from a `SwiftUI.TabView`
300+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
269301
public func introspectTabView(customize: @escaping (NSTabView) -> ()) -> some View {
270302
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
271303
}
272304

273305
/// Finds a `NSButton` from a `SwiftUI.Button`
306+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
274307
public func introspectButton(customize: @escaping (NSButton) -> ()) -> some View {
275308
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
276309
}
277310

278311
/// Finds a `NSColorWell` from a `SwiftUI.ColorPicker`
279312
@available(macOS 11, *)
313+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
280314
public func introspectColorWell(customize: @escaping (NSColorWell) -> ()) -> some View {
281315
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
282316
}
@@ -289,6 +323,7 @@ import MapKit
289323
extension View {
290324
/// Finds an `MKMapView` from a `SwiftUI.Map`
291325
@available(iOS 14, tvOS 14, macOS 11, *)
326+
@available(*, deprecated, message: "The Introspect module is deprecated and will be obsoleted later this year. Please switch over to the new and improved SwiftUIIntrospect module. More info: https://github.com/siteline/swiftui-introspect#readme")
292327
public func introspectMapView(customize: @escaping (MKMapView) -> ()) -> some View {
293328
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
294329
}

0 commit comments

Comments
 (0)