Skip to content

Swift Library inspired by Kotlin scope functions

License

Notifications You must be signed in to change notification settings

DezorkIT/Scoped

Repository files navigation

Scoped

Swift library inspired by Kotlin scope functions

Usage

Scoped already conforms to NSObject and some other types. You can find them here

let imageView = UIImageView().also {
                    $0.image = UIImage(systemName: "iphone")
                    $0.contentMode = .scaleAspectFill
                }

To use Scoped with your type you need to make an extension

extension Person: Scoped {}
let adam = Person("adam").apply {
                $0.age = 32
                $0.city = "London"
            }

You can also just use with function with any type

let anyType = with(AnyType()) {
            $0.value = "value"
        }

Installation

  1. Select File menu > Add Packages...
  2. Enter "https://github.com/DezorkIT/Scoped" into the package repository URL text field

About

Swift Library inspired by Kotlin scope functions

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages