Skip to content

Commit 60c82ee

Browse files
committed
Add introspectMapView
1 parent 72a509c commit 60c82ee

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Introspect/ViewExtensions.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import AppKit
55
#elseif canImport(UIKit)
66
import UIKit
77
#endif
8+
import MapKit
89

910
@available(iOS 13.0, tvOS 13.0, macOS 10.15.0, *)
1011
extension View {
@@ -154,6 +155,19 @@ extension View {
154155
}
155156
#endif
156157

158+
#if canImport(UIKit) || canImport(AppKit)
159+
@available(iOS 13.0, *)
160+
@available(macOS 10.15.0, *)
161+
extension View {
162+
//Finds an `MKMapView` from ab `MapKit.Map`
163+
@available(iOS 14.0, *)
164+
@available(macOS 11.0, *)
165+
public func introspectMapView(customize: @escaping (MKMapView) -> ()) -> some View {
166+
introspect(selector: TargetViewSelector.siblingContaining, customize: customize)
167+
}
168+
}
169+
#endif
170+
157171
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
158172
@available(macOS 10.15.0, *)
159173
extension View {

0 commit comments

Comments
 (0)