Github exyte Macaw-Examples swift compiler error

2019-09-20 12:34发布

问题:

The Github exyte Macaw-Example generates the following Swift compiler error:

I assume line 457 in SWXMLHash.swift may be the redeclaration.

455   /// Returned from SWXMLHash, allows easy element lookup into XML data.
456   public enum XMLIndexer: Sequence {
457      case Element(XMLElement)
458      case List([XMLElement])
459      case Stream(IndexOps)
460      case XMLError(IndexingError)

回答1:

I investigated these Macaw and SWXMLHash issues on Github and also this Swift 4 bug. Long story short:

Macaw is using the dependency SWXMLHash 3.1, which has this bug. The fix is to use the latest version of the SWXMLHash (4.0 or similar).

Easy solution: use Xcode 8.3.3

Change podspec: go into Macaw.podspec, and change the line s.dependency 'SWXMLHash', '~> 3.0.0' to s.dependency 'SWXMLHash', '~> 4.1.0'

Otherwise:

  • Download last SWXMLHash framework version

  • Copy SWXMLHash.swift and SWXMLHash+TypeConversion.swift from Source folder into your /Pods/SWXMLHash/Source folder.

  • Fix errors (there are a bit of them)

But still, should you choose the last solution - consider risks with Xcode 9, because it is still in beta.