JavApi⁴Swift

0.7.5

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

What's New

BugFix release

2023-12-11T14:53:57Z

BigDecimal.setScale, round down with .5 now works

Full Changelog: 0.7.4...0.7.5

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

By default the MIT License is used. Parts of source code use the BSD Licenses and the Public Domain / The Unlicense.

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.7.3")

or

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

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.

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.

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sun Oct 20 2024 21:15:38 GMT-0900 (Hawaii-Aleutian Daylight Time)