Skip to content

JustSugar 🍰

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

Get hints in your IDE

I built a Swift library called JustSugar to help new Swift developers coming from TypeScript. Just sugar does 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 a comment showing the Swift equivalent to use instead.
    • In this case we want to prefer the Swift method, so a deprecation warning will prompt you and shown the Swift equivalent to use instead. This is perfect for new Swift developers coming from TypeScript as a quick reference.

Example of the .slice method

example of the slice method

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

example of TS methods with deprecation warning

JustSugar Documentation

See the SPM JustSugar documentation to see all the added Array & String methods.