.package(url: "https://github.com/mesqueeb/JustSugar", from: "0.2.3")
JS-inspired Syntax Sugar on top of Swift to do two things:
- Adds useful Array and String methods inspired by JS like
.at
,.slice
,.join
, etc. - Adds all the most common JS Array and String methods to Swift, with deprecation warnings where Swift has an alternative that is just as good.
- In this case we want to prefer the Swift method, so a deprecation warning is shown when reaching for the JS method. This is perfect for new Swift developers coming from JavaScript or TypeScript.
Example of the .slice method
Example of JS methods with deprecation warning prompting to use the Swift equivalent
See the SPM JustSugar documentation for more info.
See mesqueeb.github.io/SwiftVsTypeScript for a cheatsheet comparing Swift and TypeScript.