Swiftpack.co -  Package - tonnylitao/SwiftInKotlinStyle
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
tonnylitao/SwiftInKotlinStyle
Write Swift code in Kotlin Style
.package(url: "https://github.com/tonnylitao/SwiftInKotlinStyle.git", from: "0.0.4")

SwiftInKotlinStyle

http://github.com/tonnylitao/SwiftInKotlinStyle

This Swift package can help you to write some swift code in kotlin style.

Scope Functions

  • also

    view = UIView().also {
        $0.frame = CGRect(x: 10, y: 10, widht: 100, height: 100)
        $0.backgroundColor = .red
        $0.layer.borderWidth = 1
        $0.layer.borderColor = UIColor.black.cgColor
        $0.layer.cornerRadius = 5
    }
    
  • let

    var url: Url? = nil
    ..
    url.let {
        let file = openFile($0)
        let data = read(file)
        ...
        
        return "I already read it"
        
        //or return any other type
        //e.g. return .success("I read it")
    }
    
  • takeIf

    let number = 1
    let optionalEven = number.takeIf { $0 % 2 == 0 }
    

GitHub

link
Stars: 0
Last commit: 1 week ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco