SwiftExtras

1.2.3

SwiftExtras is a Swift Package containing Extensions and Helpers for Swift which I use on a regular basis, or find useful.
0xWDG/SwiftExtras

What's New

1.2.3

2025-04-25T15:24:52Z

1.2.3

  • Updated SESettingsView
    to make the layout more consistent on multiple platforms.
  • Added Color.alphaValue
    Get the alpha value of a color
  • Added Color.redValue
    Get the red value of a color
  • Added Color.greenValue
    Get the green value of a color
  • Added Color.blueValue
    Get the blue value of a color
  • Added Color.components
    To get all the components of a color
  • Added Color.deuteranopia
    A color that simulates the appearance of the color for a person with deuteranopia. Deuteranopia is a type of red-green color blindness that affects the perception of green light.
  • Added Color.protanopia
    A color that simulates the appearance of the color for a person with protanopia. Protanopia is a type of red-green color blindness that affects the perception of red light.
  • Added Color.tritanopia
    A color that simulates the appearance of the color for a person with tritanopia. Tritanopia is a type of blue-yellow color blindness that affects the perception of blue light.
  • Added Color.inverted
    A color that simulates the appearance of the color for a person with inverted colors. Inverted colors are the opposite of the original colors.
  • Added Color.hex6
    A color that simulates the appearance of the color for a person with hex6 colors. Hex6 colors are the standard RGB colors.
  • Added Color.hsbString()
    A color that simulates the appearance of the color for a person with HSB colors. HSB colors are the standard HSB colors.
  • Added Color.hslString()
    A color that simulates the appearance of the color for a person with HSL colors. HSL colors are the standard HSL colors.
  • Added Color.labString()
    A color that simulates the appearance of the color for a person with LAB colors. LAB colors are the standard LAB colors.
  • Added Color.xyzString()
    A color that simulates the appearance of the color for a person with XYZ colors. XYZ colors are the standard XYZ colors.
  • Added Color.rgbString()
    A color that simulates the appearance of the color for a person with RGB colors. RGB colors are the standard RGB colors.
  • Added Color.resolved.alphaValue
    Get the alpha value of a resolved color
  • Added Color.resolved.blueValue
    Get the blue value of a resolved color
  • Added Color.resolved.greenValue
    Get the green value of a resolved color
  • Added Color.resolved.redValue
  • Added Color.resolved.hex
    Get the hex value of a resolved color
  • Added Color.resolved.hex6
    Get the hex6 value of a resolved color
  • Added `Color.init(_:)
    Initialize a color with a platform color
  • Added String.hashed
    Get the hash of a string
  • Added String.djb2hash
    Get the djb2 hash of a string
  • Added String.sdbmhash
    Get the sdbm hash of a string
  • Added View.render(scale:)
    Render a view to an PlatformImage with a scale
  • Added kMeansCluster(colors:clusters:iterations:)
    This function clusters a set of colors into color clusters using the k-means algorithm.

SwiftExtras

SwiftExtras is a Swift Package containing Extensions and Helpers for Swift which I use on a regular basis, or find useful.

Swift Package Manager License

Requirements

  • Swift 5.9+ (Xcode 15+)
  • iOS 16+, macOS 13+, tvOS 16+, watchOS 9+

Installation (Pakage.swift)

dependencies: [
    .package(url: "https://github.com/0xWDG/SwiftExtras.git", branch: "main"),
],
targets: [
    .target(name: "MyTarget", dependencies: [
        .product(name: "SwiftExtras", package: "SwiftExtras"),
    ]),
]

Installation (Xcode)

  1. In Xcode, open your project and navigate to File โ†’ Swift Packages โ†’ Add Package Dependency...
  2. Paste the repository URL (https://github.com/0xWDG/SwiftExtras) and click Next.
  3. Click Finish.

Contact

๐Ÿฆ‹ @0xWDG ๐Ÿ˜ mastodon.social/@0xWDG ๐Ÿฆ @0xWDG ๐Ÿงต @0xWDG ๐ŸŒ wesleydegroot.nl ๐Ÿค– Discord

Interested learning more about Swift? Check out my blog.

Description

  • Swift Tools 5.8.0
View More Packages from this Author

Dependencies

Last updated: Sun May 04 2025 01:33:07 GMT-0900 (Hawaii-Aleutian Daylight Time)