davedelong / DDMathParser

String → Number
MIT License
854 stars 153 forks source link

Add public init for MathParserError #147

Closed ffried closed 6 years ago

ffried commented 6 years ago

In Swift 4.1, you can't create an extension in another project adding an initializer that doesn't delegate (see SE-0189). While this does not affect DDMathParser itself, it affected us since we re-use the MathParserError in our code to prevent having to add basically the same error type again. This PR simply adds a public init to the error type. Since it has the same interface as the previously compiler-provided initializer, it should be fully compatible with existing code - even in Swift versions before 4.1. The latter is why I didn't conditionally include this initializer (#if swift(>4.1))...

davedelong commented 6 years ago

Sounds good to me! Thanks!