All Projects → chriskarani → Sukari

chriskarani / Sukari

Licence: MIT license
🍯 Sweet Syntactical Sugar For Swift

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Sukari

Extras
Just some extras..
Stars: ✭ 17 (-43.33%)
Mutual labels:  foundation, coregraphics
tb-grid
tb-grid is a super simple and lightweight 12 column responsive grid system utilizing css grid.
Stars: ✭ 19 (-36.67%)
Mutual labels:  foundation
reactive.foundation
reactive.foundation website
Stars: ✭ 18 (-40%)
Mutual labels:  foundation
OperationPlus
NSOperation's missing pieces
Stars: ✭ 119 (+296.67%)
Mutual labels:  foundation
Ignite
A comprehensive Flask boilerplate to build SaaS applications that includes Stripe billing, emails, login, and OAuth.
Stars: ✭ 102 (+240%)
Mutual labels:  foundation
kiva
Ground heat transfer calculation tool
Stars: ✭ 23 (-23.33%)
Mutual labels:  foundation
mesh
A page builder, simplified. Get the most flexibility to display content by adding multiple content sections within Pages, Posts, or Custom Post Types.
Stars: ✭ 44 (+46.67%)
Mutual labels:  foundation
foundation
This is a mirror from https://github.com/laravel/framework/tree/9.x/src/Illuminate/Foundation
Stars: ✭ 26 (-13.33%)
Mutual labels:  foundation
Constrainable
simple declarative autolayout µframework based on Swift 4 KeyPath
Stars: ✭ 26 (-13.33%)
Mutual labels:  syntactic-sugar
fnd-docs
Foundation developer docs
Stars: ✭ 33 (+10%)
Mutual labels:  foundation
KJCategories
Collection of native ios extensions and classes to boost development process. Such as UIKit, Foundation, QuartzCore, Accelerate, OpenCV, CoreGraphics, os and more. 超实用开发加速工具收集
Stars: ✭ 423 (+1310%)
Mutual labels:  coregraphics
foundation-server
(v1) A scalable cryptocurrency mining pool server written in Node.js
Stars: ✭ 45 (+50%)
Mutual labels:  foundation
Foundation
My Software BASE
Stars: ✭ 48 (+60%)
Mutual labels:  foundation
Swift-ISO8601-DurationParser
Swift ISO8601 Parser
Stars: ✭ 24 (-20%)
Mutual labels:  foundation
curry
curry is a framework built to enhance and compliment Foundation and UIKit.
Stars: ✭ 47 (+56.67%)
Mutual labels:  foundation
extensions-kit
📦 Collection of Swift+Apple Frameworks extensions for speeding up software development [iOS & iPadOS].
Stars: ✭ 71 (+136.67%)
Mutual labels:  foundation
tools-android
Objective-C on Android with Foundation, CoreFoundation, and libdispatch.
Stars: ✭ 38 (+26.67%)
Mutual labels:  foundation
heisenberg
Zeek WordPress starter theme based on _s and Foundation
Stars: ✭ 77 (+156.67%)
Mutual labels:  foundation
Objective-CPP
C++ compatibility library for Objective-C - Objective-CPP is a library intended to ease software development using Objective-C++. It declares categories on Objective-C classes, to work with the STL C++ types, such as std::string, std::vector, etc.
Stars: ✭ 37 (+23.33%)
Mutual labels:  foundation
ZstdFortranLib
👨‍💻Zaak's 🧩(missing) 🏛Standard 🔬Fortran 📚Library 🚧(WIP)
Stars: ✭ 17 (-43.33%)
Mutual labels:  syntactic-sugar

Sukari

🍯 Powerful, Elegant Syntactical Sugar for Swift 🍯

Description

Enjoy Beutiful Syntactic Enhancements to your swift code base

Simply add Sukari to your initializers

Use .this{} to Initialize Swiftly! 🌈

    
    let fileManager = FileManager().this {
       $0.urls(for: .applicationDirectory, in: .userDomainMask)
    }
    

Clean up your initialization Code!

  let tableView : UITableView = {
      let table = UITableView()
      table.backgroundColor = .white
      table.register(UserCell.self, forCellReuseIdentifier: "CellID")
      table.separatorStyle = .none
      table.allowsSelection = false
      return table
  }()

Initialize in this way. and and stop repeating yourself! 🚦

let tableView = UITableView().this {
    $0.backgroundColor = .white
    $0.register(UserCell.self, forCellReuseIdentifier: "CellID")
    $0.separatorStyle = .none
    $0.allowsSelection = false
}

Easily Create and Set Value Types 🛠

let point = CGPoint().set {
      $0.x = 100
      $0.y = 200
 }

Add Sugar to your own Types with a little Extension 🔌

extension CustomType: Sukari {}

let instance = CustomType().this {
      $0.color = .blue
      $0.label.text = "Custom Type"
 }

Make your code base a little Sweeter 🍭

class LoginViewController : UIViewController {
    var loginButton = UIButton().this {
        $0.setTitle("Login", for: .normal)
        $0.backgroundColor = . yellow
        $0.layer.masksToBounds = true
        $0.layer.cornerRadius = 5
    }
    
     let emailTextField = UITextField().this {
        $0.placeholder = "Email"
        $0.borderStyle = .roundedRect
        $0.font = UIFont.systemFont(ofSize: 14)
        $0.backgroundColor = UIColor(white: 0, alpha: 0.03)
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        view.addSubview(loginButton)
        view.addSubview(emailTextField)
    }
}

Unwrap

Unwrap lets you easily require Optional values.

Use unwrap() on any optional that you expect to always be non-nil, or else crash your App with a more (optional) descriptive debug message with .unwrap(debug:)

On top of that, unwrap also provides a sytactic enhancement to easily unwrap optionals through an under-the-hood Guard Statement.

  1. No More if let pyramids and Guard let Towers. only a clean and simple extension to your optionals unwrap
  2. Recieve Rich Debug Information with unwrap(debug:) screen shot 2017-12-19 at 17 35 03

Adopt this simple but effective enhancment to your code base Now!

Guard let tower spotted.

screen shot 2017-12-20 at 12 57 13

Clean, Succinct, and with more descriptive crashes!

screen shot 2017-12-20 at 13 03 52

Usage

Call unwrap() on any Optional, optionally giving a debugMessage for debugging purposes:

struct Person {
    let name: String
    let email: String
    init(dictionary: [String: Any]) {
        name = dictionary["name"].unwrap(debug: "Unable to find json Element Name") as! String
        email = dictionary["email"].unwrap(debug: "Unable to find json Element Email") as! String
    }
}
    let dictionary = ["ame": "Chris", "email": "[email protected]"]
    let chris = Person(dictionary: dictionary)
    print(chris.name) //Chris
    print(chris.email) // [email protected]

Another Real-World Example

Without Using Unwrap

class LoginController: UIViewController {
    var token: Token?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // more code is more bugs
        guard let unwrappedToken = token else {
            // if this crashes we enter a 'nil' state in our app with no debug information
            return
        }
        LoginService.login(unwrappedToken)
    }
    
}

With Unwrap

class LoginController: UIViewController {
    var token: Token?
    override func viewDidLoad() {
        super.viewDidLoad()
        LoginService.login(token.unwrap())
    }
}

Installing

  • For iOS 8+ projects with CocoaPods:
    pod 'Sukari'

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

Chris Karani

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].