/JavApi4Swift

JavApi⁴Swift is an implementation of Java API in pure Swift under business friendly license. It require no Java on System

Primary LanguageSwiftApache License 2.0Apache-2.0

JavApi⁴Swift

This project provides a Java like API in 100%-pure Swift instead bridging to Java virtual machine. In result you do not need a Java virtual machine. On the otherside you can port Java code to Swift without Big-Bang step by step.

This project use MinD pattern to reduce dependency and eat other great resources.

License

This project use only business friendly permissive licenses.

Floss-license-slide-image Image: David A. Wheeler, et al., CC BY-SA 3.0 , via Wikimedia Commons

Parts of source code use the BSD Licenses and the Public Domain / The Unlicense. By default I use the MIT License. Parts of source code use the Apache 2.0 license.

thanks

Special thanks to contributors of

Usage

When working with XCode add dependency

https://github.com/bastie/JavApi4Swift.git

When working with SwiftPM add dependency

.package(url: "https://github.com/bastie/JavApi4Swift.git", from: "0.19.1")

or

.Package(url: "https://github.com/bastie/JavApi4Swift.git", .upToNextMajor(from: "0.19.1"))

Ports

I'm implementing some porting projects to check JavApi⁴Swift releases and look for the next missing features. The use could start from version 0.4.2. Check out these projects and learn how to use JavApi⁴Swift.

0.4.2

  • ASCII-Data is a library to display tables and graphs on command line as ASCII or ANSI.

0.7.4

  • LStXML2Code is a library and CLI to generate source code for German income tax calculation based on Federal Ministry of Finance provided XML Pseudocode.

0.8.0

  • iban4j is a library for generation and validation of the International Bank Account Numbers (IBAN ISO_13616) and Business Identifier Codes (BIC ISO_9362).

0.12.0

  • ShrinkItArchive is a library for managing Apple ][ ShrinkIt / NuFX archives.

0.19.1

  • STar is a simple Swift Tar library, that provides an easy way to create and read tar files using.

Development

include other projects

To honor the work of the developer of other project let the history come inside.

To include other project with compatible license do

# Example for some types from a jzlib clone
#
# clone the other project local, jzlib clone are here https://github.com/kohsuke/jzlib.git
 
git clone https://github.com/kohsuke/jzlib.git otherProject

# go into project directory and remove the origin
cd otherProject
git remote rm origin

# filter project to remove all unwanted data and commit it
git filter-branch --subdirectory-filter src/main/java/com/jcraft/jzlib -- --all
git rm Deflat*.java GZIP*.java Inf*.java Z*.java Tree.java StaticTree.java JZl*.java
git commit -m "ready to import"

# go to JavApi project directory
cd ../JavApi4Swift

# add (temporary) the local other project as remote source and pull wanted data with history
git remote add importSource ../otherProject
git pull importSource master --no-rebase --allow-unrelated-histories
git remote rm importSource

# work on conflicts f.e. in .gitignore

# optional take a look into history
git log

JavApi style guide

  1. The ported Java source code should not to modify more than needed.
  2. I like short lines and so indent is 2 spaces.
  3. Types are in same name files like Java with the exception of java.lang types.
  4. The opend curly braces are in the same line.
  5. packages are mapped over enums in files named as java.basepackagename.packagename.swift in result of compiler problems with more than one identical files names.
  6. Exported parameters of Java translated, non-private function parameter are marked with underline.
  7. Exceptions are mapped over extension of Error enumeration.
  8. Default methods are in extensions implemented.
  9. Swiftify code are implemented in extensions.
  10. All previous points are non-binding recommendations with no binding effect.