Swiftpack.co - tonnylitao/SwiftInKotlinStyle as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by tonnylitao.
tonnylitao/SwiftInKotlinStyle 0.0.4
Write Swift code in Kotlin Style
⭐️ 0
🕓 2 years ago
iOS macOS watchOS tvOS
.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: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

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