JustSugar

0.2.3

🍰 JS-inspired Syntax Sugar on top of Swift to make working with Arrays/Strings/... easier
mesqueeb/JustSugar

What's New

2024-07-28T05:04:05Z
  • feat: prompt to use Swift's .replaceSubrange instead of JS's .fill 06ce994
  • chore: update docs eac0832
  • chore: bump a9dde1f

v0.2.2...v0.2.3

JustSugar 🍰

.package(url: "https://github.com/mesqueeb/JustSugar", from: "0.2.2")

JS-inspired Syntax Sugar on top of Swift to do two things:

  1. Adds useful Array and String methods inspired by JS like .at, .slice, .join, etc.
  2. 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 the slice method

Example of JS methods with deprecation warning prompting to use the Swift equivalent

example of JS methods with deprecation warning

Full Documentation

See the SPM JustSugar documentation for more info.

TypeScript VS Swift Cheatsheet

See mesqueeb.github.io/SwiftVsTypeScript for a cheatsheet comparing Swift and TypeScript.

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri May 16 2025 15:00:14 GMT-0900 (Hawaii-Aleutian Daylight Time)