Skip to content

BetaS/Java2Swift-Class-Converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java -> Swift2 Object Converter

This is a simple converter for Java Class to Swift2.x Class using regex

Online converter available : http://betas.github.io/Java2Swift-Class-Converter/

Convert this -> self, null -> nil

Function & Parameter Convert

[Origin]

public int func1() {
  blahblahblah
}

[Converted]

func func1() -> Int {
  blahblahblah
}

Constructor Convert

[Origin]

class Test {
  public Test(int foo) {
    blahblahblah
  }
}

[Converted]

class Test {
  init(foo: Int) {
    blahblahblah
  }
}

Variable Decleration Convert

[Origin]

class Test {
  private int foo = 0;
  private String bar;
}

[Converted]

class Test {
  var foo: Int = 0;
  var bar: String = ""; // Auto generated default value as same as Java
}

ToDo

  • Support convert options
    • convert 'private' or 'protected' to 'internal'
    • spacing after ':' character
    • external parameter name to '_'
    • remove ';'

About

Converter for Java Class to Swift2.0 Class

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published