Git Product home page Git Product logo

swiftui-introspect's Introduction

SwiftUI Introspect

CI Status Badge Swift Version Compatibility Badge Platform Compatibility Badge

SwiftUI Introspect allows you to get the underlying UIKit or AppKit element of a SwiftUI view.

For instance, with SwiftUI Introspect you can access UITableView to modify separators, or UINavigationController to customize the tab bar.

How it works

SwiftUI Introspect works by adding an invisible IntrospectionView on top of the selected view, and an invisible "anchor" view underneath it, then looking through the UIKit/AppKit view hierarchy between the two to find the relevant view.

For instance, when introspecting a ScrollView...

ScrollView {
    Text("Item 1")
}
.introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18)) { scrollView in
    // do something with UIScrollView
}

... it will:

  1. Add marker views in front and behind ScrollView.
  2. Traverse through all subviews between both marker views until a UIScrollView instance (if any) is found.

Important

Although this introspection method is very solid and unlikely to break in itself, future OS releases require explicit opt-in for introspection (.iOS(.vXYZ)), given potential differences in underlying UIKit/AppKit view types between major OS versions.

By default, the .introspect modifier acts directly on its receiver. This means calling .introspect from inside the view you're trying to introspect won't have any effect. However, there are times when this is not possible or simply too inflexible, in which case you can introspect an ancestor, but you must opt into this explicitly by overriding the introspection scope:

ScrollView {
    Text("Item 1")
        .introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18), scope: .ancestor) { scrollView in
            // do something with UIScrollView
        }
}

Usage in production

SwiftUI Introspect is meant to be used in production. It does not use any private API. It only inspects the view hierarchy using publicly available methods. The library takes a defensive approach to inspecting the view hierarchy: there is no hard assumption that elements are laid out a certain way, there is no force-cast to UIKit/AppKit classes, and the .introspect modifier is simply ignored if UIKit/AppKit views cannot be found.

Install

Swift Package Manager

Xcode

Package.swift

let package = Package(
    dependencies: [
        .package(url: "https://github.com/siteline/swiftui-introspect", from: "1.0.0"),
    ],
    targets: [
        .target(name: <#Target Name#>, dependencies: [
            .product(name: "SwiftUIIntrospect", package: "swiftui-introspect"),
        ]),
    ]
)

CocoaPods

pod 'SwiftUIIntrospect', '~> 1.0'

Introspection

Implemented

Missing an element? Please start a discussion. As a temporary solution, you can implement your own introspectable view type.

Cannot implement

SwiftUI Affected Frameworks Why
Text UIKit, AppKit Not a UILabel / NSLabel
Image UIKit, AppKit Not a UIImageView / NSImageView
Button UIKit Not a UIButton

Examples

List

List {
    Text("Item")
}
.introspect(.list, on: .iOS(.v13, .v14, .v15)) { tableView in
    tableView.backgroundView = UIView()
    tableView.backgroundColor = .cyan
}
.introspect(.list, on: .iOS(.v16, .v17, .v18)) { collectionView in
    collectionView.backgroundView = UIView()
    collectionView.subviews.dropFirst(1).first?.backgroundColor = .cyan
}

ScrollView

ScrollView {
    Text("Item")
}
.introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18)) { scrollView in
    scrollView.backgroundColor = .red
}

NavigationView

NavigationView {
    Text("Item")
}
.navigationViewStyle(.stack)
.introspect(.navigationView(style: .stack), on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18)) { navigationController in
    navigationController.navigationBar.backgroundColor = .cyan
}

TextField

TextField("Text Field", text: <#Binding<String>#>)
    .introspect(.textField, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18)) { textField in
        textField.backgroundColor = .red
    }

Advanced usage

Implement your own introspectable type

Missing an element? Please start a discussion.

In case SwiftUI Introspect (unlikely) doesn't support the SwiftUI element that you're looking for, you can implement your own introspectable type.

For example, here's how the library implements the introspectable TextField type:

import SwiftUI
@_spi(Advanced) import SwiftUIIntrospect

public struct TextFieldType: IntrospectableViewType {}

extension IntrospectableViewType where Self == TextFieldType {
    public static var textField: Self { .init() }
}

#if canImport(UIKit)
extension iOSViewVersion<TextFieldType, UITextField> {
    public static let v13 = Self(for: .v13)
    public static let v14 = Self(for: .v14)
    public static let v15 = Self(for: .v15)
    public static let v16 = Self(for: .v16)
    public static let v17 = Self(for: .v17)
}

extension tvOSViewVersion<TextFieldType, UITextField> {
    public static let v13 = Self(for: .v13)
    public static let v14 = Self(for: .v14)
    public static let v15 = Self(for: .v15)
    public static let v16 = Self(for: .v16)
    public static let v17 = Self(for: .v17)
}

extension visionOSViewVersion<TextFieldType, UITextField> {
    public static let v1 = Self(for: .v1)
}
#elseif canImport(AppKit)
extension macOSViewVersion<TextFieldType, NSTextField> {
    public static let v10_15 = Self(for: .v10_15)
    public static let v11 = Self(for: .v11)
    public static let v12 = Self(for: .v12)
    public static let v13 = Self(for: .v13)
    public static let v14 = Self(for: .v14)
}
#endif

Introspect on future platform versions

By default, introspection applies per specific platform version. This is a sensible default for maximum predictability in regularly maintained codebases, but it's not always a good fit for e.g. library developers who may want to cover as many future platform versions as possible in order to provide the best chance for long-term future functionality of their library without regular maintenance.

For such cases, SwiftUI Introspect offers range-based platform version predicates behind the Advanced SPI:

import SwiftUI
@_spi(Advanced) import SwiftUIIntrospect

struct ContentView: View {
    var body: some View {
        ScrollView {
            // ...
        }
        .introspect(.scrollView, on: .iOS(.v13...)) { scrollView in
            // ...
        }
    }
}

Bear in mind this should be used cautiously, and with full knowledge that any future OS version might break the expected introspection types unless explicitly available. For instance, if in the example above hypothetically iOS 19 stops using UIScrollView under the hood, the customization closure will never be called on said platform.

Keep instances outside the customize closure

Sometimes, you might need to keep your introspected instance around for longer than the customization closure lifetime. In such cases, @State is not a good option because it produces retain cycles. Instead, SwiftUI Introspect offers a @Weak property wrapper behind the Advanced SPI:

import SwiftUI
@_spi(Advanced) import SwiftUIIntrospect

struct ContentView: View {
    @Weak var scrollView: UIScrollView?

    var body: some View {
        ScrollView {
            // ...
        }
        .introspect(.scrollView, on: .iOS(.v13, .v14, .v15, .v16, .v17, .v18)) { scrollView in
            self.scrollView = scrollView
        }
    }
}

Community projects

Here's a list of open source libraries powered by the SwiftUI Introspect library:

If you're working on a library built on SwiftUI Introspect or know of one, feel free to submit a PR adding it to the list.

swiftui-introspect's People

Contributors

aaryankotharii avatar chrismaddern avatar crayment avatar davdroman avatar dependabot[bot] avatar dmonagle avatar ethanbonin avatar grdsdev avatar iansampson avatar jannthomas avatar jevonmao avatar joelpoloney avatar jordanekay avatar kaishin avatar kkebo avatar kotivskyi avatar krzyzanowskim avatar ldiqual avatar lechium avatar michaeljberk avatar nuplay avatar orospakr avatar paescebu avatar renovate[bot] avatar rzulkoski avatar sergeirr avatar simba909 avatar splittydev avatar steipete avatar vukrado avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swiftui-introspect's Issues

Introspection not working for SwiftUI advances in iOS 14

I recently use introspection to add a toolbar on top of keyboard on some textfields (and also to manage first responder).
I just tried on Xcode 12 Beta 1, with iOS 14 device, it's not working anymore, nothing is added.

With this basic usage via a ViewModifier :

struct KeyboardToolbar: ViewModifier {
    private let toolbarCoordinator = ToolbarCoordinator()
    var actions: [KeyboardToolbarAction]

    init(actions: [KeyboardToolbarAction]) {
        self.actions = actions
    }

    func body(content: Content) -> some View {
        content.introspectTextField {
            self.buildToolbar(on: $0)
        }
    }

    private func buildToolbar(on textField: UITextField) {
        guard textField.inputAccessoryView == nil else { return }
        let customToolbar = UIToolbar()
        customToolbar.items = toolbarCoordinator.createBarButtonItems(on: textField, actions: actions)
        customToolbar.sizeToFit()
        textField.inputAccessoryView = customToolbar
    }
}

The introspectTextField handler is never called. I suspect the view hierarchy has changed in iOS 14.
To give you a quick snap of the view hierarchy in iOS 14 :

Screenshot 2020-06-24 at 16 04 47

Using with SwiftPM

This may very well be just me, but I had some issues including this package in SwiftPM.

For reference, based on how swift-argument-parser is included, I naively tried including it like so:

dependencies: [
    .package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "0.3.0")),
    .package(url: "https://github.com/siteline/SwiftUI-Introspect", .upToNextMinor(from: "0.1.2")), // <---
  ],
...
targets: [
    .target(
      name: "MyApplication",
      dependencies: [
        .product(name: "ArgumentParser", package: "swift-argument-parser"),
        .product(name: "Introspect", package: "SwiftUI-Introspect"),  // <---
      ]
  )
]

This gave me the following error:

error: product dependency 'Introspect' in package 'SwiftUI-Introspect' not found

It turns out, SwiftPM is quite particular to how packages and names are specified (see https://www.timc.dev/posts/understanding-swift-packages/). By default, as is the case with swift-argument-parser, it assumes that the name of the package is the name of the repository, which is untrue for this project. One therefore has to explicitly specify the name of the repository to the name of the project as specified in the Package.swift file (Introspect).

The name of the product included is the name of the target from the project / package as specified in package.

To include this project using SwiftPM, simply add it as show here:

  dependencies: [
    .package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "0.3.0")),
    .package(name: "Introspect", url: "https://github.com/siteline/SwiftUI-Introspect", .upToNextMinor(from: "0.1.2")), // <--
  ],
  targets: [
    .target(
      name: "QuickTerm",
      dependencies: [
        .product(name: "ArgumentParser", package: "swift-argument-parser"),
        .product(name: "Introspect", package: "Introspect"), // <--

introspectTextField becomeFirstResponder() broken

Using the latest version of Introspect 0.1.0, there seems to be a bug that does not allow you to select any field other than the first responder field. When you tap into another field, it immediately refocuses on the first responder TextField.

Thinking I had a bug in my implementation, I looked back at another project from January 2020 that uses introspectTextField with becomeFirstResponder(). The implementation was identical. Building the old project worked fine, and I was able to select another field without issue. Looking at the Introspect version, it is 0.0.6.

On further investigation, this issue seems to have been introduced sometime in early February. This might help us narrow down the version changes.

Here are a couple comments in Stackoverflow that also suggest this bug was introduced around early February: Link to SO answer

Edit: Looking at the releases, there was only the one 0.1.0 release in February. This makes it easier to isolate.

I will look through the changes since version 0.0.6, when I have time.

Add CI via Github Actions

Explore GitHub Actions as a separate CI and possible future replacement of CircleCI.

GitHub Actions are well integrated with PRs and allow for a more seamless CI experience.
They also support macOS 11 out of the box, which will prevent many headaches in the future.

Roadmap:

  • Setup GitHub Actions in the same way as the current CircleCI configuration
  • Use both GitHub Actions and CircleCI for some time to make sure the integration is stable
  • Talk to @siteline developers about plans to replace CircleCI
  • Get rid of CircleCI entirely?

Swift 5.2 compiler barfs on use of .introspectTextField

This is really just FYI, since it's likely to be a compiler bug.

When I use Introspect in one of my views, I'm getting a segmentation fault when I build in release, using Xcode 11.4b2.

Removing the use of .introspectTextField is enough to fix it.

Stack trace included below. Note that the output is a little confusing, and at first glance looks like it's related to the warning near the top. I don't think that's the case.

Showing All Messages
CompileSwift normal x86_64 (in target 'ActionStatusMobile' from project 'ActionStatus')
    cd /Users/developer/Projects/ActionStatus
    /Applications/Xcode11.4b2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Model/Model.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusMobile/MobileApplication.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/SceneDelegate.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Application.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Views/EditView.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusMobile/DocumentPickerViewController.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/WorkflowGenerator.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/SparkleUpdater.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Model/Option.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Views/ComposeView.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Views/SparkleView.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Model/Repo.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Model/Job.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Views/ContentView.swift -supplementary-output-file-map /var/folders/zp/khj_8k6909d9m4y7wjljl41h0000gp/T/supplementaryOutputs-269f9d -target x86_64-apple-ios13.2-macabi -enable-objc-interop -stack-check -sdk /Applications/Xcode11.4b2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -I /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/BuildProductsPath/Release-maccatalyst -F /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/BuildProductsPath/Release-maccatalyst -Fsystem /Applications/Xcode11.4b2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks -g -module-cache-path /Users/developer/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity=checked -O -serialize-debugging-options -Xcc -working-directory -Xcc /Users/developer/Projects/ActionStatus -Xcc -I/Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Action\ Status-generated-files.hmap -Xcc -I/Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Action\ Status-own-target-headers.hmap -Xcc -I/Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Action\ Status-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Action\ Status-project-headers.hmap -Xcc -I/Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/BuildProductsPath/Release-maccatalyst/include -Xcc -isystem -Xcc /Applications/Xcode11.4b2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/usr/include -Xcc -I/Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/DerivedSources-normal/x86_64 -Xcc -I/Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/DerivedSources/x86_64 -Xcc -I/Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/DerivedSources -import-objc-header /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Resources/BridgingHeader.h -pch-output-dir /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/PrecompiledHeaders -module-name ActionStatus -num-threads 12 -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/Model.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/MobileApplication.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/SceneDelegate.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/Application.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/EditView.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/DocumentPickerViewController.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/WorkflowGenerator.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/SparkleUpdater.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/Option.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/ComposeView.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/SparkleView.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/Repo.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/Job.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/ContentView.o

/Users/developer/Projects/ActionStatus/Sources/ActionStatusMobile/MobileApplication.swift:12:8: warning: implicit import of bridging header 'BridgingHeader.h' via module 'SparkleBridgeClient' is deprecated and will be removed in a later version of Swift
import SparkleBridgeClient
       ^
Stack dump:
0.	Program arguments: /Applications/Xcode11.4b2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Model/Model.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusMobile/MobileApplication.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/SceneDelegate.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Application.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Views/EditView.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusMobile/DocumentPickerViewController.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/WorkflowGenerator.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/SparkleUpdater.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Model/Option.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Views/ComposeView.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Views/SparkleView.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Model/Repo.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Model/Job.swift /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Views/ContentView.swift -supplementary-output-file-map /var/folders/zp/khj_8k6909d9m4y7wjljl41h0000gp/T/supplementaryOutputs-269f9d -target x86_64-apple-ios13.2-macabi -enable-objc-interop -stack-check -sdk /Applications/Xcode11.4b2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -I /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/BuildProductsPath/Release-maccatalyst -F /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/BuildProductsPath/Release-maccatalyst -Fsystem /Applications/Xcode11.4b2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/System/Library/Frameworks -g -module-cache-path /Users/developer/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity=checked -O -serialize-debugging-options -Xcc -working-directory -Xcc /Users/developer/Projects/ActionStatus -Xcc -I/Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Action Status-generated-files.hmap -Xcc -I/Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Action Status-own-target-headers.hmap -Xcc -I/Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Action Status-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Action Status-project-headers.hmap -Xcc -I/Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/BuildProductsPath/Release-maccatalyst/include -Xcc -isystem -Xcc /Applications/Xcode11.4b2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/iOSSupport/usr/include -Xcc -I/Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/DerivedSources-normal/x86_64 -Xcc -I/Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/DerivedSources/x86_64 -Xcc -I/Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/DerivedSources -import-objc-header /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Resources/BridgingHeader.h -pch-output-dir /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/PrecompiledHeaders -module-name ActionStatus -num-threads 12 -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/Model.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/MobileApplication.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/SceneDelegate.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/Application.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/EditView.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/DocumentPickerViewController.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/WorkflowGenerator.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/SparkleUpdater.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/Option.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/ComposeView.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/SparkleView.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/Repo.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/Job.o -o /Users/developer/Library/Developer/Xcode/DerivedData/ActionStatus-eyxiiohnmopaeecoqfsepoodpvxl/Build/Intermediates.noindex/ArchiveIntermediates/ActionStatusMac/IntermediateBuildFilesPath/ActionStatus.build/Release-maccatalyst/ActionStatusMobile.build/Objects-normal/x86_64/ContentView.o 
1.	Apple Swift version 5.2 (swiftlang-1103.0.25.1 clang-1103.2.32.5)
2.	While emitting SIL for getter for body (at /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Views/EditView.swift:68:9)
3.	While silgen emitFunction SIL function "@$s12ActionStatus8EditViewV4bodyQrvg".
 for getter for body (at /Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Views/EditView.swift:68:9)
4.	While silgen closureexpr SIL function "@$s12ActionStatus8EditViewV4bodyQrvg7SwiftUI05TupleD0VyAE7SectionVyAE05EmptyD0VAGyAE6HStackVyAGyAE4TextV_AE0D0P10IntrospectE010introspectL5Field9customizeQrySo06UITextO0Cc_tFQOyAE15ModifiedContentVyAqAE12nameOrgStyleQryFQOyAE0lO0VyAOG_Qo_AA11ClearButtonVG_Qo_tGG_AMyAGyAO_A4_tGGA9_AMyAGyAO_AXyAqAE010branchListV0QryFQOyA0__Qo_A3_GtGGtGAKG_AIyAkGyAMyAGyAO_AOtGG_AMyAGyAO_AoE6SpacerVAE0X0Vy0F12UIExtensions11SystemImageVGtGGA28_tGAKGtGyXEfU_".
 for expression at [/Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Views/EditView.swift:69:14 - line:151:13] RangeText="{
            Section {
                HStack {
                    Text("Name")
                        .font(.callout)
                        .bold()
                    TextField("github repo name", text: $name)
                        .nameOrgStyle()
                        .modifier(ClearButton(text: $name))
                        .introspectTextField { textField in
                            textField.becomeFirstResponder()
                        }
                }
                
                HStack {
                    Text("Owner")
                        .font(.callout)
                        .bold()
                    
                    TextField("github user or organisation", text: $owner)
                        .nameOrgStyle()
                        .modifier(ClearButton(text: $owner))
                }
                
                HStack {
                    Text("Workflow")
                        .font(.callout)
                        .bold()
                    
                    TextField("Tests.yml", text: $workflow)
                        .nameOrgStyle()
                        .modifier(ClearButton(text: $workflow))
                }

                HStack {
                    Text("Branches")
                        .font(.callout)
                        .bold()
                    
                    TextField("comma-separated list of branches (leave empty for default branch)", text: $branches)
                        .branchListStyle()
                        .modifier(ClearButton(text: $branches))
                }

            }
            
            Section {
                HStack {
                    Text("Workflow File")
                        .font(.callout)
                        .bold()
                    
                    Text("\(trimmedWorkflow).yml")
                }

                HStack {
                    Text("Repo URL")
                        .font(.callout)
                        .bold()
                    
                    Text("https://github.com/\(trimmedOwner)/\(trimmedName)")
                    
                    Spacer()
                    
                    Button(action: { self.repo.openInGithub(destination: .repo) }) {
                        SystemImage("arrowshape.turn.up.right")
                    }
                }
                
                HStack{
                    Text("Workflow URL")
                        .font(.callout)
                        .bold()
                    
                    Text("https://github.com/\(trimmedOwner)/\(trimmedName)/actions?query=workflow%3A\(trimmedWorkflow)")
                    
                    Spacer()
                    
                    Button(action: { self.repo.openInGithub(destination: .workflow) }) {
                        SystemImage("arrowshape.turn.up.right")
                    }
                }
            "
5.	While silgen closureexpr SIL function "@$s12ActionStatus8EditViewV4bodyQrvg7SwiftUI05TupleD0VyAE7SectionVyAE05EmptyD0VAGyAE6HStackVyAGyAE4TextV_AE0D0P10IntrospectE010introspectL5Field9customizeQrySo06UITextO0Cc_tFQOyAE15ModifiedContentVyAqAE12nameOrgStyleQryFQOyAE0lO0VyAOG_Qo_AA11ClearButtonVG_Qo_tGG_AMyAGyAO_A4_tGGA9_AMyAGyAO_AXyAqAE010branchListV0QryFQOyA0__Qo_A3_GtGGtGAKG_AIyAkGyAMyAGyAO_AOtGG_AMyAGyAO_AoE6SpacerVAE0X0Vy0F12UIExtensions11SystemImageVGtGGA28_tGAKGtGyXEfU_A15_yXEfU_".
 for expression at [/Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Views/EditView.swift:70:21 - line:111:17] RangeText="{
                HStack {
                    Text("Name")
                        .font(.callout)
                        .bold()
                    TextField("github repo name", text: $name)
                        .nameOrgStyle()
                        .modifier(ClearButton(text: $name))
                        .introspectTextField { textField in
                            textField.becomeFirstResponder()
                        }
                }
                
                HStack {
                    Text("Owner")
                        .font(.callout)
                        .bold()
                    
                    TextField("github user or organisation", text: $owner)
                        .nameOrgStyle()
                        .modifier(ClearButton(text: $owner))
                }
                
                HStack {
                    Text("Workflow")
                        .font(.callout)
                        .bold()
                    
                    TextField("Tests.yml", text: $workflow)
                        .nameOrgStyle()
                        .modifier(ClearButton(text: $workflow))
                }

                HStack {
                    Text("Branches")
                        .font(.callout)
                        .bold()
                    
                    TextField("comma-separated list of branches (leave empty for default branch)", text: $branches)
                        .branchListStyle()
                        .modifier(ClearButton(text: $branches))
                "
6.	While silgen closureexpr SIL function "@$s12ActionStatus8EditViewV4bodyQrvg7SwiftUI05TupleD0VyAE7SectionVyAE05EmptyD0VAGyAE6HStackVyAGyAE4TextV_AE0D0P10IntrospectE010introspectL5Field9customizeQrySo06UITextO0Cc_tFQOyAE15ModifiedContentVyAqAE12nameOrgStyleQryFQOyAE0lO0VyAOG_Qo_AA11ClearButtonVG_Qo_tGG_AMyAGyAO_A4_tGGA9_AMyAGyAO_AXyAqAE010branchListV0QryFQOyA0__Qo_A3_GtGGtGAKG_AIyAkGyAMyAGyAO_AOtGG_AMyAGyAO_AoE6SpacerVAE0X0Vy0F12UIExtensions11SystemImageVGtGGA28_tGAKGtGyXEfU_A15_yXEfU_A6_yXEfU_".
 for expression at [/Users/developer/Projects/ActionStatus/Sources/ActionStatusCommon/Views/EditView.swift:71:24 - line:80:25] RangeText="{
                    Text("Name")
                        .font(.callout)
                        .bold()
                    TextField("github repo name", text: $name)
                        .nameOrgStyle()
                        .modifier(ClearButton(text: $name))
                        .introspectTextField { textField in
                            textField.becomeFirstResponder()
                        "
0  swift                    0x000000010e34a033 PrintStackTraceSignalHandler(void*) + 51
1  swift                    0x000000010e3497f0 SignalHandler(int) + 352
2  libsystem_platform.dylib 0x00007fff63e7342d _sigtramp + 29
3  swift                    0x0000000109eaa1f0 swift::ProtocolConformanceRef llvm::function_ref<swift::ProtocolConformanceRef (swift::CanType, swift::Type, swift::ProtocolDecl*)>::callback_fn<swift::ReplaceOpaqueTypesWithUnderlyingTypes>(long, swift::CanType, swift::Type, swift::ProtocolDecl*) + 0
4  swift                    0x000000010a1102e8 (anonymous namespace)::Transform::transform(swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::SGFContext) + 12680
5  swift                    0x000000010a10d148 swift::Lowering::SILGenFunction::emitOrigToSubstValue(swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::SGFContext) + 136
6  swift                    0x000000010a08c896 swift::Lowering::Conversion::emit(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::SGFContext) const + 710
7  swift                    0x000000010a02d91d (anonymous namespace)::ScalarResultPlan::finish(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::CanType, llvm::ArrayRef<swift::Lowering::ManagedValue>&) + 1021
8  swift                    0x000000010a049558 swift::Lowering::SILGenFunction::emitApply(std::__1::unique_ptr<swift::Lowering::ResultPlan, std::__1::default_delete<swift::Lowering::ResultPlan> >&&, swift::Lowering::ArgumentScope&&, swift::SILLocation, swift::Lowering::ManagedValue, swift::SubstitutionMap, llvm::ArrayRef<swift::Lowering::ManagedValue>, swift::Lowering::CalleeTypeInfo const&, swift::Lowering::ApplyOptions, swift::Lowering::SGFContext) + 1784
9  swift                    0x000000010a0574cf (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3951
10 swift                    0x000000010a0538c7 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2567
11 swift                    0x000000010a04f125 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 3685
12 swift                    0x000000010a04ad93 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 163
13 swift                    0x000000010a05d57e (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 238
14 swift                    0x000000010a05d3f9 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus) && + 537
15 swift                    0x000000010a05afab (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 1179
16 swift                    0x000000010a0573c8 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3688
17 swift                    0x000000010a0538c7 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2567
18 swift                    0x000000010a0a6473 swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 131
19 swift                    0x000000010a12be2d swift::Lowering::SILGenFunction::emitReturnExpr(swift::SILLocation, swift::Expr*) + 845
20 swift                    0x000000010a1274e6 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 12598
21 swift                    0x000000010a1244f6 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 326
22 swift                    0x000000010a0d6faf swift::Lowering::SILGenFunction::emitClosure(swift::AbstractClosureExpr*) + 719
23 swift                    0x000000010a03f8e4 swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*) + 244
24 swift                    0x000000010a0ba4f8 (anonymous namespace)::RValueEmitter::visitAbstractClosureExpr(swift::AbstractClosureExpr*, swift::Lowering::SGFContext) + 40
25 swift                    0x000000010a04f72b (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 5227
26 swift                    0x000000010a04ad93 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 163
27 swift                    0x000000010a05d57e (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 238
28 swift                    0x000000010a05d3f9 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus) && + 537
29 swift                    0x000000010a05afab (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 1179
30 swift                    0x000000010a0573c8 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3688
31 swift                    0x000000010a0538c7 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2567
32 swift                    0x000000010a04f125 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 3685
33 swift                    0x000000010a04ad93 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 163
34 swift                    0x000000010a05d57e (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 238
35 swift                    0x000000010a05d3f9 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus) && + 537
36 swift                    0x000000010a05afab (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 1179
37 swift                    0x000000010a0573c8 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3688
38 swift                    0x000000010a0538c7 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2567
39 swift                    0x000000010a0a6473 swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 131
40 swift                    0x000000010a12be2d swift::Lowering::SILGenFunction::emitReturnExpr(swift::SILLocation, swift::Expr*) + 845
41 swift                    0x000000010a1274e6 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 12598
42 swift                    0x000000010a1244f6 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 326
43 swift                    0x000000010a0d6faf swift::Lowering::SILGenFunction::emitClosure(swift::AbstractClosureExpr*) + 719
44 swift                    0x000000010a03f8e4 swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*) + 244
45 swift                    0x000000010a0ba4f8 (anonymous namespace)::RValueEmitter::visitAbstractClosureExpr(swift::AbstractClosureExpr*, swift::Lowering::SGFContext) + 40
46 swift                    0x000000010a04f72b (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 5227
47 swift                    0x000000010a04ad93 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 163
48 swift                    0x000000010a05d57e (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 238
49 swift                    0x000000010a05d3f9 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus) && + 537
50 swift                    0x000000010a05afab (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 1179
51 swift                    0x000000010a0573c8 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3688
52 swift                    0x000000010a0538c7 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2567
53 swift                    0x000000010a04f125 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 3685
54 swift                    0x000000010a04ad93 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 163
55 swift                    0x000000010a05d57e (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 238
56 swift                    0x000000010a05d3f9 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus) && + 537
57 swift                    0x000000010a05afab (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 1179
58 swift                    0x000000010a0573c8 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3688
59 swift                    0x000000010a0538c7 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2567
60 swift                    0x000000010a0a6473 swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 131
61 swift                    0x000000010a12be2d swift::Lowering::SILGenFunction::emitReturnExpr(swift::SILLocation, swift::Expr*) + 845
62 swift                    0x000000010a1274e6 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 12598
63 swift                    0x000000010a1244f6 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 326
64 swift                    0x000000010a0d6faf swift::Lowering::SILGenFunction::emitClosure(swift::AbstractClosureExpr*) + 719
65 swift                    0x000000010a03f8e4 swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*) + 244
66 swift                    0x000000010a0ba4f8 (anonymous namespace)::RValueEmitter::visitAbstractClosureExpr(swift::AbstractClosureExpr*, swift::Lowering::SGFContext) + 40
67 swift                    0x000000010a04f72b (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 5227
68 swift                    0x000000010a04ad93 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 163
69 swift                    0x000000010a05d57e (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 238
70 swift                    0x000000010a05d3f9 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus) && + 537
71 swift                    0x000000010a05afab (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 1179
72 swift                    0x000000010a0573c8 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3688
73 swift                    0x000000010a0538c7 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2567
74 swift                    0x000000010a04f125 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 3685
75 swift                    0x000000010a04ad93 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 163
76 swift                    0x000000010a05d57e (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 238
77 swift                    0x000000010a05d3f9 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus) && + 537
78 swift                    0x000000010a05afab (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 1179
79 swift                    0x000000010a0573c8 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3688
80 swift                    0x000000010a0538c7 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2567
81 swift                    0x000000010a04f125 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 3685
82 swift                    0x000000010a04ad93 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 163
83 swift                    0x000000010a05d57e (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 238
84 swift                    0x000000010a05d3f9 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus) && + 537
85 swift                    0x000000010a05afab (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 1179
86 swift                    0x000000010a0573c8 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3688
87 swift                    0x000000010a0538c7 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2567
88 swift                    0x000000010a04f125 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 3685
89 swift                    0x000000010a04ad93 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 163
90 swift                    0x000000010a05d57e (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 238
91 swift                    0x000000010a05d3f9 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus) && + 537
92 swift                    0x000000010a05afab (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 1179
93 swift                    0x000000010a0573c8 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3688
94 swift                    0x000000010a0538c7 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2567
95 swift                    0x000000010a0abe3f swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 22495
96 swift                    0x000000010a0a6473 swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 131
97 swift                    0x000000010a12be2d swift::Lowering::SILGenFunction::emitReturnExpr(swift::SILLocation, swift::Expr*) + 845
98 swift                    0x000000010a1274e6 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 12598
99 swift                    0x000000010a1244f6 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 326
100 swift                    0x000000010a0d646f swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 1055
101 swift                    0x000000010a03b9c9 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 953
102 swift                    0x000000010a138cc8 void llvm::function_ref<void (swift::AccessorDecl*)>::callback_fn<(anonymous namespace)::SILGenType::visitAccessors(swift::AbstractStorageDecl*)::'lambda'(swift::AccessorDecl*)>(long, swift::AccessorDecl*) + 24
103 swift                    0x000000010a138c2c (anonymous namespace)::SILGenType::visitVarDecl(swift::VarDecl*) + 1948
104 swift                    0x000000010a1357fb (anonymous namespace)::SILGenType::emitType() + 1163
105 swift                    0x000000010a045f22 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 82
106 swift                    0x000000010a0450ec swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 1356
107 swift                    0x000000010a0471ca swift::SILModule::constructSIL(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions&, swift::FileUnit*) + 1530
108 swift                    0x0000000109c16ecb swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 62331
109 swift                    0x0000000109b87b83 main + 1299
110 libdyld.dylib            0x00007fff63c7a7fd start + 1
error: Segmentation fault: 11 (in target 'ActionStatusMobile' from project 'ActionStatus')

CPU usage at 100% when updating @Published CGFloat

An app I am building requires that a UIScroller grid has its position updated by another 'master' UIScroller.
I am using Introspect to monitor the content offset of a master UIScroller which then updates a CGFloat in a store class from which a slave UIScroller updates its position. Currently ScrollViewProxy will permit users to go between grid items using the scrollTo function but this appears to be meant for users to 'jump' between large numbers of items - whereas I am trying to achieve continuous scrolling so the existing scrollTo isn't what Im looking for.

This actually works reasonably well to any visual indications, both the scrollers scroll smoothly but the cpu usage goes through the roof, really to the point where the app would just not be useable.

I suspect that I'm misusing the Introspect capability in some way, can anyone explain how I correctly expose things like the scrollViewDidScroll function from the UIScrollerDelegate and the UIScrollers contentOffset? Is the introspect something that should only be called once at the init of any control using it?

this is the code, just two Scrollers a store containing the @published CGFloat and a coloredSquare struct that appears in each Scroller
code:

//================================================
class UIScrollStore : ObservableObject {
    @Published var expFloat : CGFloat = .zero
}

struct ColoredSquare : View , Identifiable{
    var id = UUID()
    @State var red : Double
    var body: some View{
        return ZStack{
        Color(red: red, green: 1, blue: 0)
        }.frame(width: 30, height: 30)
    }
}

struct ScrollViewExample: View {
    var colorSquares = [ColoredSquare]()
    @ObservedObject var uIScrollStore = UIScrollStore()
    init() {
    makeScrollerRectangles()
    }
    mutating func makeScrollerRectangles(){
        for i in 0...100{
            let sq = ColoredSquare(red: Double(i)*0.01)
            self.colorSquares.append(sq)
        }
    }
    var body: some View {
        HStack {
            //================ MASTER SCROLLER ==============================
            ScrollView {
                LazyVStack{
                    ForEach(colorSquares){sq in
                        sq
                    }
                }
                .introspectScrollView { scrollView in
                scrollView.layer.backgroundColor = UIColor.red.cgColor
                uIScrollStore.expFloat = scrollView.contentOffset.y
                }
            }
            //================ SLAVE SCROLLER ==============================
            ScrollView {
                LazyVStack{
                    ForEach(colorSquares){sq in
                        sq
                    }
                }
                .introspectScrollView { scrollView in
                scrollView.layer.backgroundColor = UIColor.orange.cgColor
                scrollView.contentOffset.y = uIScrollStore.expFloat
                }
            }
        }
    }
}

Segmentation fault when archiving

I'm getting a segmentation fault when trying to archive the app if I use any introspection methods. I'm integrating via SPM. Compiled fine otherwise, it's really only when archiving that I run into the issue.

Here's the code that's causing the fault:

ScrollView(.vertical, showsIndicators: self.showScrollIndicator) {
    ...
}
.introspectScrollView { (scrollView) in
    // Commenting this out fixes the issue
}

Here's the stack trace I get during archive:

0  swift                    0x000000010c2ee4ea PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x000000010c2edcc0 SignalHandler(int) + 352
2  libsystem_platform.dylib 0x00007fff7301d5fd _sigtramp + 29
3  libsystem_platform.dylib 0x00007ffee7c5c060 _sigtramp + 1958996608
4  swift                    0x00000001085281c8 (anonymous namespace)::Transform::transform(swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::SGFContext) + 12680
5  swift                    0x0000000108525028 swift::Lowering::SILGenFunction::emitOrigToSubstValue(swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::SGFContext) + 136
6  swift                    0x00000001084a5886 swift::Lowering::Conversion::emit(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::SGFContext) const + 710
7  swift                    0x000000010844782d (anonymous namespace)::ScalarResultPlan::finish(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::CanType, llvm::ArrayRef<swift::Lowering::ManagedValue>&) + 1021
8  swift                    0x0000000108462c28 swift::Lowering::SILGenFunction::emitApply(std::__1::unique_ptr<swift::Lowering::ResultPlan, std::__1::default_delete<swift::Lowering::ResultPlan> >&&, swift::Lowering::ArgumentScope&&, swift::SILLocation, swift::Lowering::ManagedValue, swift::SubstitutionMap, llvm::ArrayRef<swift::Lowering::ManagedValue>, swift::Lowering::CalleeTypeInfo const&, swift::Lowering::ApplyOptions, swift::Lowering::SGFContext) + 1784
9  swift                    0x00000001084707bf (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3951
10 swift                    0x000000010846cc47 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2567
11 swift                    0x00000001084bf223 swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 131
12 swift                    0x0000000108543c1d swift::Lowering::SILGenFunction::emitReturnExpr(swift::SILLocation, swift::Expr*) + 845
13 swift                    0x000000010853f2fe swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 12590
14 swift                    0x000000010853c316 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 326
15 swift                    0x00000001084efac0 swift::Lowering::SILGenFunction::emitClosure(swift::AbstractClosureExpr*) + 640
16 swift                    0x0000000108458f14 swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*) + 244
17 swift                    0x00000001084d3088 (anonymous namespace)::RValueEmitter::visitAbstractClosureExpr(swift::AbstractClosureExpr*, swift::Lowering::SGFContext) + 40
18 swift                    0x0000000108468afb (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 5243
19 swift                    0x00000001084643b3 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 163
20 swift                    0x00000001084766ce (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 238
21 swift                    0x0000000108476549 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus) && + 537
22 swift                    0x0000000108474208 (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::CanTypeWrapper<swift::FunctionType>&, swift::Lowering::AbstractionPattern&, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::Optional<swift::SILLocation>&, swift::CanTypeWrapper<swift::FunctionType>&) + 1032
23 swift                    0x00000001084706b8 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3688
24 swift                    0x000000010846cc47 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 2567
25 swift                    0x00000001084c4b9a swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 22410
26 swift                    0x00000001084bf223 swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 131
27 swift                    0x0000000108543c1d swift::Lowering::SILGenFunction::emitReturnExpr(swift::SILLocation, swift::Expr*) + 845
28 swift                    0x000000010853f2fe swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 12590
29 swift                    0x000000010853c316 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 326
30 swift                    0x00000001084eefdf swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 799
31 swift                    0x00000001084551b9 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 953
32 swift                    0x0000000108550a18 void llvm::function_ref<void (swift::AccessorDecl*)>::callback_fn<(anonymous namespace)::SILGenType::visitAccessors(swift::AbstractStorageDecl*)::'lambda'(swift::AccessorDecl*)>(long, swift::AccessorDecl*) + 24
33 swift                    0x000000010855097c (anonymous namespace)::SILGenType::visitVarDecl(swift::VarDecl*) + 1948
34 swift                    0x000000010854d53b (anonymous namespace)::SILGenType::emitType() + 1163
35 swift                    0x000000010845f5e2 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 82
36 swift                    0x000000010845e7ac swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 1356
37 swift                    0x000000010846088a swift::SILModule::constructSIL(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions&, swift::FileUnit*) + 1530
38 swift                    0x00000001080423cb swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 55595
39 swift                    0x0000000107fb84d3 main + 1283
40 libdyld.dylib            0x00007fff72e24cc9 start + 1

Does not work with Mac Catalyst

When using in with Mac Catalyst / UIKit for Mac were are compiler errors, due to

https://github.com/siteline/SwiftUI-Introspect/blob/de5c32c15ae169cfcb27397ffb2734dcd0e1e6d5/Introspect/ViewExtensions.swift#L117

since some AppKit functionality is supported, but it ist still based on UIKit.

Many subsequent lines throw error then, like

'NSView' is unavailable in Mac Catalyst

in

https://github.com/siteline/SwiftUI-Introspect/blob/de5c32c15ae169cfcb27397ffb2734dcd0e1e6d5/Introspect/ViewExtensions.swift#L121

'NSTableView' is unavailable in Mac Catalyst

in

https://github.com/siteline/SwiftUI-Introspect/blob/de5c32c15ae169cfcb27397ffb2734dcd0e1e6d5/Introspect/ViewExtensions.swift#L132

and so on.

When use NavigationLink push 2 Views , .introspectNavigationController() not works any more.

When FIRST run , root and C1 will change the navigationBar.backgroundColor as expected ,but when go to c2 ,this navigationBar.backgroundColor will not change any more.

here is my code

import SwiftUI
import Introspect

struct ContentView: View {
    
    var body: some View {
        NavigationView{
            VStack{
                Text("Root")
                NavigationLink(destination: C1()){
                    Text("Go To C1")
                }.isDetailLink(false)
            }.navigationBarTitle("Root",displayMode: .inline)
        }.introspectNavigationController(){ navigationController in
            navigationController.navigationBar.backgroundColor = .red
        }
    }
}

struct C1: View {    
    var body: some View {
    
        VStack{
            NavigationLink(destination: C2()){
                Text("Go To C2")
            }
        }.introspectNavigationController(){ navigationController in
            navigationController.navigationBar.backgroundColor = .yellow
        }.navigationBarTitle("C1")
    }
}

struct C2: View {
    var body: some View {
        VStack{
            NavigationLink(destination: C3()){
                Text("Go To C3")
            }
        }.introspectNavigationController(){ navigationController in
            navigationController.navigationBar.backgroundColor = .blue
        }.navigationBarTitle("C2")
    }
}

struct C3: View {
    var body: some View {
        VStack{
            Text("C3")
        }.introspectNavigationController(){ navigationController in
            navigationController.navigationBar.backgroundColor = .black
        }.navigationBarTitle("C3")
    }
}

Introspect List

I want to use Introspect on a list which is using the SidebarListStyle. Using introspectTableView doesn't work.

Navigation bar has large title doesn't work correctly

After setting tableView's separator to none, the navigation bar becomes transparent and won't react during scrolling such as shrinking, changing color.
Guess changing tableView's property will destroy the scroll delegate somehow.

TabView Badge Value get re-initialized

First off, amazing initiative, really love this for gapping the miss between SwiftUI and UIKit

    TabView { 
     ...
     }
    .introspectTabBarController { tabBarController in
        tabBarController.viewControllers?.first?.tabBarItem.badgeValue = "5" // Test
    }

I used the introspectTabBarController on TabView to set a badgeValue, it works perfectly but as soon as I switch tab, the batch disappears

thanks

Introspecting ScrollView when running iOS 14 provides a UIFieldEditor or UITextView

Both of which must be UIScrollViews but not the intended scroll view. ha

    ScrollView {
        //VStack including Text, TextField, and UITextField, UITextView (UIViewRepresentable)
    }
    .introspectScrollView() { scrollView in
        print(scrollView) //is UIFieldEditor or UITextView instead of UIScrollView in iOS 14
    }

<UITextView: 0x7fa20615b000; frame = (0 0; 343 22); text = ''; clipsToBounds = YES; gestureRecognizers = <NSArray: 0x6000003d44b0>; layer = <CALayer: 0x600000dab520>; contentOffset: {0, 0}; contentSize: {343, 22}; adjustedContentInset: {0, 0, 0, 0}>
<UIFieldEditor: 0x7fa20611c600; frame = (0 0; 343 22); text = ''; clipsToBounds = YES; opaque = NO; gestureRecognizers = <NSArray: 0x6000003e8750>; layer = <CALayer: 0x600000daea60>; contentOffset: {0, 0}; contentSize: {343, 22}; adjustedContentInset: {0, 0, 0, 0}>

NSButton works

The readme claims that buttons can't be introspected but I tried this and it absolutely works:

extension View {
    public func introspectButton(customize: @escaping (NSButton) -> ()) -> some View {
        return inject(AppKitIntrospectionView(
            selector: { introspectionView in
                guard let viewHost = Introspect.findViewHost(from: introspectionView) else {
                    return nil
                }
                return Introspect.previousSibling(containing: NSButton.self, from: viewHost)
            },
            customize: customize
        ))
    }
}

Example setting button as default action:

Button(action: {  })
    .introspectButton { button in
        button.keyEquivalent = "\r"
    }

Have not tested this against iOS UIButton, just AppKit NSButton. If someone is feeling frisky, they can add proper button support to the library as outlined above.

min requirement on macOS is 15.0

in ViewExtensions the min version is 15.0 for macOS (@available(macOS 15.0, *)).
Shouldn't it me 10.15 as in @available(macOS 10.15, *)? I'm having a lot of problems using it in a macOS project

Plan to support macOS/AppKit ?

Hi, I'm author of SDWebImageSwiftUI, which is a full cross-platform (iOS/tvOS/macOS/watchOS/macCatalyst) image loading framework for SwiftUI.

Recentlly I use the introspect framework to test the View of that framework. Which is one UIViewRepresentable and NSViewRepresentable

However, seems this framework does not works on macOS/AppKit, any plan to update ? I found it's not so hard to implements. You should just change the API with NSHostingView, there are small differenences between UIKit/AppKit for SwiftUI corporate.

SwiftUI: Tabbar doesn't appear again after hiding it.

Hi, I use Introspect to hide my Tabbar in one of my subviews. That works really great but when I go back the Tabbar is still hidden. But I added the modifier that the Tabbar should appear again / be visible.
Does someone have a solution?

Outdated release

Version 0.1.0 doesn't contains fixes for mac Catalyst support. Please release new version

UISplitViewController Introspection

I tried to do this:

extension View {
    public func introspectSplitViewController(customize: @escaping (UISplitViewController) -> ()) -> some View {
        return inject(UIKitIntrospectionViewController(
            selector: { introspectionView in
                guard let viewHost = Introspect.findViewHost(from: introspectionView) else {
                    return nil
                }
                return Introspect.previousSibling(containing: UISplitViewController.self, from: viewHost)
            },
            customize: customize
        ))
    }
}

But I got this error:
Cannot convert value of type 'UIViewController' to expected argument type 'PlatformView' (aka 'UIView')

What I am doing wrong?

Character input shifts back to initial textfield when using multiple text fields

So I am using this package with multiple text fields in a SwiftUI form. When the form starts up, the first textfield becomes the first responder and all is good. I type in that field then press TAB to get to next field. As soon as I start typing, the caret moves to the original field and characters get typed in that field rather than the field I tabbed to.

Here is the snippet of code that uses the introspection call:

VStack(alignment: .leading) { Text("Task name:") TextField("Enter a name for this task", text: $task.name) .formTextField(.words) // using the Introspect Package .introspectTextField { textField in textField.becomeFirstResponder() } } VStack(alignment: .leading) { Text("Section name:") TextField("Enter a name for this task's section", text: $task.group) .formTextField(.words) }

textField.becomeFirstResponder() is reason for bad transition

When I use

 `TextField("onboarding_name_firstname".localized, text: $state.firstName)
            .textFieldStyle(TextFields(.bordered))
            .disableAutocorrection(true)
            .accessibility(identifier: "onboarding_name_firstname")
            .introspectTextField(customize: { textField in
                textField.becomeFirstResponder()
            })`

on opening this screen it looks like screen was opened twice: one without keyboard, the second with.
Commenting string textField.becomeFirstResponder() helps with such transition but off course keyboard is closed

Compiler Error only when archiving

I'm trying to archive my app, but for some reason I'm getting this errors:

צילום מסך 2020-10-14 ב-20 15 42

Happens when I'm archiving or when just building using Any iOS Device.
Tried deleting my derived folder, uninstall Cocoapods and reinstall all the pods.
Nothing works.

Does any one have an idea?

How to use findAncestor?

Suppose I'd want to save the contentOffset of a UITableView whenever I click an element inside of it.
E.g.

List {
    ForEach(items, id: \.self) { element in
         Button(element) {
             navigation.contentOffset = // get tableview contentOffset
         }
    }
}

How can I use findAncestor to get the parent UITableView's contentOffset?
I've tried using this

Introspect.findAncestor(ofType: UITableView, from: UIButton) as? UITableView

but the compiler returns:

Cannot convert value of type 'UIButton.Type' to expected argument 'PlatformView' (aka 'UIView')

I've already tried using a UILabel instead of UIButton and it gives me the same error.

How to use Introspect in backwards compatible projects

I have an app that supports iOS 11 and up but we're transferring parts of it to SwiftUI. I want to use Introspect but cocoapods complains about Introspect's iOS 13 deployment target.

Is there a simple way to fix this?

I'm pretty sure SwiftUI adds backwards compatibility by adding @available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) to it's public types.

TextField.introspectTextField not calling

XCode 11.3, new project, code like this:

TextField(
                        hasTags ? "" : self.placeholder,
                        text: self.$searchText,
                        onEditingChanged: self.handleEditingChanged,
                        onCommit: {
                            print("onCommit")
                        }
                    )
                        .introspectTextField { textField in
                            print("we got a text field here \(textField)")
                    }

When I run it works as expected, but we got a text field here never logs/runs.

Listen ScrollView `contentOffset` and set it

hi there, I'm late for the party. As title, can we using this library to do something like this? Listen ScrollView contentOffset and set it. Sorry if I asking question at wrong place.

Strong reference caused bug

Hello, I really like your work, this is fantastic library to help building better views in SwiftUI. I am reporting a weird problem, and hopefully you can take a look

Error message

InstrospectTest[86126:3366995] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '<_TtGC7SwiftUI16PlatformViewHostGVS_P13$7fff3be90fe832PlatformViewRepresentableAdaptorGVS_P13$7fff3bede09022BridgedSystemTextFieldVS_20_TextFieldStyleLabel___ 0x10071ef20> has reached dealloc but still has a super view. Super views strongly reference their children, so this is being over-released, or has been over-released in the past.'

My environment:

  • Xcode Version 11.4.1 (11E503a)
  • Apple Swift version 5.2.2 (swiftlang-1103.0.32.6 clang-1103.0.32.51)
  • SwiftUI-Introspect (0.1.0 installed from Swift Package Manager for master branch)

My body part:

var body: some View {
    VStack {
      TextField("", text: $text)
        .font(.system(size: 32))
        .introspectTextField { textField in
          textField.font = .systemFont(ofSize: 32)
        }// no crash would ever happen if remove this .introspectTextField 
      ForEach(visible.startIndex ..< visible.endIndex, id: \.self) { index in
        VStack {
        Text("\(self.content[index])")
        Text("\(index)")
        }
      }.frame(width: 300, alignment: .top)
        .onReceive(keyPublisher, perform: keyPressed(_:))
    }
  }

Why I think it's a problem of Introspect

When it crashes, the very last stack trace I can see from debugger is line 198 of Introspect.swift

Besides, if I remove this .introspectTextField function call, the problem will be gone.

Attempts made to narrow down problem

  • Leave .introspectTextField block empty
    • Crash. Conclusion: the .introspectTextField function crashed the program, instead of what's in the call block
  • Remove .introspectTextField entirely
    • No crash
  • Remove Text("\(self.content[index])") from VStack
    • No crash
  • Remove Text("\(index)") from VStack
    • No crash
  • Combine Text("\(self.content[index])") and Text("\(index)") in VStack to one Text
    • No crash

How to reproduce

I have packed my test code here, download and unzip, and open with Xcode. Then run it, and type any number in the TextField. Use down arrow key to scroll down to the bottom, and up arrow to go up. It should crash near the bottom

Call for maintainers

I'm currently twiddling my thumbs while waiting for #56 to be merged, so I decided to take a look at the insights.

The last commit was some README updates in July, and the last actual code change was back in May, before the first iOS 14 beta.

I was tempted to copy this project's code into my project so that I can fix the problems I was having, but upon reading some of the code, I'm realizing that this is a pretty solid project. It's well-documented, the code is clean, it's written in a safe way, and it's tested. It's just currently suffering from a lack of love.

I would be happy to fork this repo and take ownership of the library, but I work full-time so I wouldn't always have much time to maintain it.

Is there someone else who has the availability to take proper ownership of this project? Or is there anyone on the current contributors list who would like to chime in?

Best way to handle `isSecureTextEntry`

I created this ViewModifier but when initially shown the text is not presented as isSecureTextEntry == true even though isSecure is true. Any idea why?! thanks! 😄

struct SecureToggle: ViewModifier {

        @State public var isSecure: Bool = true
        
        public func body(content: Content) -> some View {
            
            HStack {
                content
                    .introspectTextField { (textfield) in
                        textfield.isSecureTextEntry = isSecure
                    }
                
                Spacer()
                
                Button(action: {
                    self.isSecure.toggle()
                }) {
                    Image(systemName: isSecure ? "eye.slash":"eye")
                        .foregroundColor(Color.Nikola.lightBlue)
                }
                .padding()
            }
        }
        
    }

Introspector in iOS 14 not working for ScrollView...

First of all the specs: iOS 14, Xcode 12.2 beta and Catalina running on my Mac.

I tried to add a pulltorefresh function to a ScrollView in Swiftui but it doesnt show up. Actually the whohle introspect is never called. I tried a few times and it actually only works if I change it to List, but not with ScrollView like it is shown in the Github example. As I defo need it for ScrollView I need your help. Cheers...

So this one actually works:

List {
ForEach(0..<100)
{ _ in
Text("hello")
}
}
.introspectScrollView { scrollView in
print("Test")
scrollView.refreshControl = UIRefreshControl()
}

while this does not:

ScrollView {
ForEach(0..<100)
{ _ in
Text("hello")
}
}
.introspectScrollView { scrollView in
print("Test")
scrollView.refreshControl = UIRefreshControl()
}

Problem when applying filters on a ScrollView ancestor

Hi,
I'm using the lib in order to access and control the behaviour of a ScrollView in my app.
I works very well and makes it possible to work around SwiftUI's limitations.
However, I have a problem when applying a filter such as saturation() on the root view of my app.
It seems like doing this "breaks" something and introspectScrollView() is not called anymore.

The structure of the app is fairly complex with a lot of nesting, but the issue can be reproduced in a simpler example:

struct ContentView: View {
	@State var hasScrollView:Bool = false
	
	var body: some View {
		VStack{
			Text("Has ScrollView: \(hasScrollView ? "True":"False")")
			ScrollView{
				VStack{
					ForEach((1...50), id: \.self) {
						item($0)
					}
				}
			}
			.introspectScrollView{ scrollView in
				hasScrollView = true
			}
		}
		//hasScrollView is only true if we remove this
		.saturation(0)
	}
	
	func item(_ value:Int)->some View{
		HStack{
			Text("\(value)")
			Spacer()
		}
		.border(Color.red)
		.padding(10)
	}
}

Note: After doing some testing, it looks like moving the introspectScrollView() block after the saturation() call fixes the problem, but it would be quite messy to do it like this in the actual app, as it would mean having the introspectScrollView() and the code that relies on it at a different level and in different files.

Any insight would be greatly appreciated.

Question : Is this good practice ?

Hi, if I wanted to store the underlying view inside a variable that can be accessed later, is below code good practice ?

struct ContentView: View {
    @State var content: String = ""
    @State var _textField:UITextField?

...
TextField("Content", text: $content)
.introspectTextField { textField in
                            print("debug")
                            _textField=textField
  }    

so that later I can call that _textField?.becomeFirstResponder() like

Button(action: {
    _textField?.becomeFirstResponder()
}) {
    Text("Focus it")
}

Will the _textField become memory leak ?

Thanks for answering

TextField.introspectTextField called many times causing high input latency

I added a to my macOS app like so

                TextField("", text: $text)
                    .introspectTextField { textField in
                        textField.becomeFirstResponder()
                }

After adding the introspectTextField function, all interactions in my app are extremely slow (several seconds) and cause a rainbow spinner. If I add a print statement to the introspectTextField body, I can see that it is called many, many times.

Removing that function resolves the performance issues.

NavigationView Introspection with a NavigationViewStyle

I'm trying to prevent a navigation flow from using the iPad detail/two-column layout and instead use a stack navigation layout like it does on iPhone. For this I need to use .navigationViewStyle(StackNavigationViewStyle()); however, this seems to conflict with .introspectNavigationController. When I have both of them on at the same time, the navigation style is properly used, yet the introspect closure is never called. The instant I remove .navigationViewStyle, the introspect starts working again.

Here's a small reproducible example:

struct TestNavigationView: View {
    var body: some View {
        NavigationView {
            NavigationLink("Go To View", destination: Text("Subview"))
        }
        // Disable the "split view" (aka Detail View) layout on iPad
        .navigationViewStyle(StackNavigationViewStyle())
        .introspectNavigationController() { navigationController in
            // This is not called unless the .navigationViewStyle call above is commented out
            print("Introspect called with navigationController \(navigationController.debugDescription)")
        }
        .onAppear() {
            // This is called
            print("View does show up")
        }
    }
}

I might be wrong as I don't have much experience with UIKit, but it might be that the .navigationViewStyle changes what underlying UIKit view is rendered since the iPad two-column-style navigation view is different from the typical NavigationViewController. Still this doesn't explain why this also fails to work on iPhone, since it shouldn't be using a UISplitViewController anyway.

Perhaps I can temporarily circumvent this with a custom introspect, or something else?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.