tmandry/AXSwift

Xcode 11.4.1 errors w Swift 5.2.2

Closed this issue · 1 comments

After updating to XCode 11.4.1 I have a couple errors I do not know how to resolve. Any pointers on how to fix these compile errors?

I have rebuilt the framework in XCode 11.4.1 with Swift 5.2.2 without issue, but when using the framework in my project I receive the following errors:

  1. Errors:
    a) Cannot infer contextual base in reference to member 'size' AND
    b) Generic parameter 'T' could not be inferred
    let w = myWindowObject

    if let size: CGSize? = try? w.axData.uiWindowElement.attribute(.size) {
        originalSize = size!
    }

  1. Error: Cannot convert value of type 'Optional<Optional<_>>' to specified type 'CGSize??'
        if let size: CGSize? = try? uiElement.attribute(.size) {
            ...
        }
  1. Error: Cannot convert value of type 'Optional<Optional<_>>' to specified type 'String??'
    if let title: String? = try? element.attribute(.title) {
        ...
    }

Any suggestion would be greatly appreciated. i will be working to resolve the errors on my own and will report any progress here.

I fixed all 3 compile errors. None of them were caused by the AXSwift.framework, but rather my mediocre programming skills. I've changed my implementation.

Changed:

if let title: String? = try? element.attribute(.title) {
        ...
}

To:

if let title: String = try! element.attribute(.title) {
         ...
}

Thanks for your work on this project. I use in in my WindowMizer.app. If you'd like a free license, hit me up!