https://github.com/bastie/JavApi4Swift
Test to port mature mostly object orientend API to Swift. Take a look to JavApi project.
- create struct with package called
NiceClass
- create classes in struct extension for
NiceClass
- create protocols outside struct extension called
swjftBadProtocol
- create typealias called
BadProtocol
in struct extension forswjftBadProtocol
struct lang {}
extension lang {
class String : CharSequence {}
}
protocol swjftCharSequence {}
extension lang {
typealias CharSequence = swjftCharSequence
}
- create protocol (see How to porting package structure)
- 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."
}
}