/swjft

Swift

Primary LanguageSwiftISC LicenseISC

see JavApi4Swift project

https://github.com/bastie/JavApi4Swift

Swjft

Test to port mature mostly object orientend API to Swift. Take a look to JavApi project.

HowTo

How to porting package structure

  1. create struct with package called NiceClass
  2. create classes in struct extension for NiceClass
  3. create protocols outside struct extension called swjftBadProtocol
  4. create typealias called BadProtocol in struct extension for swjftBadProtocol
struct lang {}
extension lang {
  class String : CharSequence {}
}
protocol swjftCharSequence {}
extension lang {
  typealias CharSequence = swjftCharSequence
}

Hot to create abstract classes

  1. create protocol (see How to porting package structure)
  2. use extensions for implements like Java default methods for protocol
struct nio {}
protocol swjftCharBuffer {}
extension nio {
  typealias CharBuffer = swjftCharBuffer
}
extension swjftCharBuffer {
  func toString () -> Swift.String {
     return "Like default methods, I am the CharBuffer implementation."
  }
}