{"id":18918912,"url":"https://github.com/fernandospr/minimal-android-ios-backend-lib","last_synced_at":"2026-04-09T20:43:49.325Z","repository":{"id":70832372,"uuid":"510837200","full_name":"fernandospr/minimal-android-ios-backend-lib","owner":"fernandospr","description":"Minimal Kotlin library to share logic in Android, iOS and JVM Backend projects.","archived":false,"fork":false,"pushed_at":"2024-01-23T12:38:49.000Z","size":1183,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-12-31T15:54:25.775Z","etag":null,"topics":["android","backend","ios","jvm","kotlin","kotlin-multiplatform","library","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fernandospr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-07-05T17:41:08.000Z","updated_at":"2024-01-12T19:31:57.000Z","dependencies_parsed_at":"2023-12-08T18:30:34.824Z","dependency_job_id":"e17ed460-abf4-4e70-ac1f-4362edac7b2c","html_url":"https://github.com/fernandospr/minimal-android-ios-backend-lib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fernandospr%2Fminimal-android-ios-backend-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fernandospr%2Fminimal-android-ios-backend-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fernandospr%2Fminimal-android-ios-backend-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fernandospr%2Fminimal-android-ios-backend-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fernandospr","download_url":"https://codeload.github.com/fernandospr/minimal-android-ios-backend-lib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239914929,"owners_count":19717760,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","backend","ios","jvm","kotlin","kotlin-multiplatform","library","swift"],"created_at":"2024-11-08T10:34:16.728Z","updated_at":"2026-03-12T10:30:18.795Z","avatar_url":"https://github.com/fernandospr.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"Demonstrates a minimal Kotlin library to share logic in Android, iOS and JVM Backend projects using Kotlin Multiplatform.\n\nThis repository contains the following folders:\n* minimal-android-ios-backend-lib\n* android-sample-app\n* ios-sample-app\n* backend-sample-app\n\n## minimal-android-ios-backend-lib\nContains the Kotlin code to share across platforms.\n\nYou'll find this simple class:\n```kotlin\nclass Example {\n  fun hello(who: String) = \"Hello $who!\"\n}\n```\n### Compiling the library for Android/JVM apps\n1. Execute the Gradle Task: `publishToMavenLocal` using `./gradlew publishToMavenLocal`.\nThis task will publish in your `~/.m2/repository` folder.\n\n2. Open the Android/JVM/Backend client project and make sure you have `mavenLocal()` in your repositories configuration.\n3. Add the dependency:\n* For Android: `implementation(\"{group}:{rootProject.name}-android:{version}\")`. For this example, it's `implementation(\"com.github.fernandospr:minimal-android-ios-backend-lib-android:1.0.0\")`.\n* For JVM: `implementation(\"{group}:{rootProject.name}-jvm:{version}\")`. For this example, it's `implementation(\"com.github.fernandospr:minimal-android-ios-backend-lib-jvm:1.0.0\")`.\n4. Now in your Android/JVM app code you can import the library classes.\n  \n### Compiling the library for iOS apps\n1. Execute the Gradle Task: `assemble{libName}ReleaseXCFramework` using `./gradlew assemble{libName}ReleaseXCFramework`. For this example, it's `./gradlew assembleMAIBLibReleaseXCFramework`. This task will generate the framework in `build/XCFrameworks/release` of the library project.\n2. Copy the framework to your iOS client project.\n3. Open your iOS client project using Xcode, go to the project properties, open `General` tab and add the framework in the `Frameworks, Libraries and Embedded Content` section.\n4. Now in your iOS app code you can import the library classes.\n\n## android-sample-app\nContains a sample Android App that uses the library.\n\nTo build this app you'll need to compile the library locally first, as explained above.\n\n`MainActivity.kt` contains the following code that uses the `Example` class from the library:\n\n```kotlin\nimport com.github.fernandospr.maiblib.Example\n\nclass MainActivity : AppCompatActivity() {\n  override fun onCreate(savedInstanceState: Bundle?) {\n    ...\n    val example = Example()\n    findViewById\u003cTextView\u003e(R.id.textView).text = example.hello(\"Fernando\")\n  }\n}\n```\n\n### Screenshots\n\u003cimg width=\"200\" alt=\"android-maiblib-sample\" src=\"https://user-images.githubusercontent.com/4404680/177391909-a2043ddd-54c1-4186-88f7-aa16f8185cea.png\"\u003e\n\n\n## ios-sample-app\nContains a sample iOS App that uses the library.\n\nTo build this app you'll need to compile the library locally and copy it to the iOS project folder, as explained above.\n\n`ViewController.swift` contains the following code that uses the `Example` class from the library:\n\n```swift\nimport MAIBLib\n\nclass ViewController: UIViewController {\n  ...\n  override func viewDidLoad() {\n    ...\n    let example = Example()\n    label.text = example.hello(who: \"Fernando\")\n  }\n}\n```\n\n### Screenshots\n\u003cimg width=\"200\" alt=\"ios-maiblib-sample\" src=\"https://user-images.githubusercontent.com/4404680/177391856-ff00adae-6392-4164-8fd5-d5d5b5949eb2.png\"\u003e\n\n## backend-sample-app\nContains a sample Kotlin Backend App that uses the library.\n\nTo build this app you'll need to compile the library locally first, as explained above.\n\n`Controller.kt` contains the following code that uses the `Example` class from the library:\n```kotlin\nimport com.github.fernandospr.maiblib.Example\n\n@RestController\n@RequestMapping(\"/web\")\nclass WebController {\n\n  @GetMapping(\"/hello\")\n  fun hello(@RequestParam(\"who\") who: String) = Example().hello(who)\n}\n\n@RestController\n@RequestMapping(\"/api\")\nclass ApiController {\n\n  @GetMapping(\"/hello\")\n  fun hello(@RequestParam(\"who\") who: String) = ApiResponse(Example().hello(who))\n}\n```\n\n### Screenshots\nUsing the `Example` class in a Web server that returns a String:\n\n\u003cimg width=\"512\" alt=\"backend-web-maiblib-sample\" src=\"https://user-images.githubusercontent.com/4404680/177391204-da62b53f-2bb2-4830-aefe-ddbd5bab12ed.png\"\u003e\n\nUsing the `Example` class in an API that returns JSON:\n\n\u003cimg width=\"500\" alt=\"backend-api-maiblib-sample\" src=\"https://user-images.githubusercontent.com/4404680/177391224-2c4572c6-9aaf-47d7-8a6b-4a1cceabd402.png\"\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffernandospr%2Fminimal-android-ios-backend-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffernandospr%2Fminimal-android-ios-backend-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffernandospr%2Fminimal-android-ios-backend-lib/lists"}