Giter VIP home page Giter VIP logo

switchcasegenerator's Introduction

Swift Switch Enum Case Generator

An Xcode Source Editor Extension that makes a swift switch case statement with selected enum cases

Generate switch example

Why?

Because Xcode does not autocomplete a switch with enum cases.

Installation

  1. Clone or download the repo
  2. Open SwitchCaseGenerator.xcodeproj
  3. Enable target signing for both the Application and the Source Code Extension using your own developer ID
  4. Select the application target and then Product > Archive
  5. Export the archive as a macOS App
  6. Run the app, then quit (Don't delete the app, put it in a convenient folder)
  7. Go to System Preferences -> Extensions -> Xcode Source Editor and enable the GenerateCases extension
  8. The menu-item should now be available from Xcode's Editor menu

Shortcut

Preferences (โŒ˜ + ,) -> Key Bindings -> Search for "cases" Shortcut example

switchcasegenerator's People

Contributors

timaktimak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

switchcasegenerator's Issues

Add support for Enums with associated values

Say I have the following enum

enum UserField {
        case id(Int)
        case username(String)
        case vision(Int, Int)
        case height(feet: Int, inches: Int)
}

Then the following switch should be generated:

switch value {
case .id(let value):
    break
case .username(let username):
    break
case .vision(let value1, let value2):
    break
case .height(let feet, let inches):
    break
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.