Skip to content

Instantly share code, notes, and snippets.

View Ribesg's full-sized avatar
🇫🇷

Gael Ribes Ribesg

🇫🇷
View GitHub Profile
@Ribesg
Ribesg / !README.md
Last active June 20, 2022 15:00
How to use a Kotlin MPP library depending on an iOS Framework in a XCode iOS App

This gist demonstrates how to use a Kotlin MPP library which depends on an iOS Framework in a native iOS application (XCode project).

First, see [how the Kotlin MPP Library is built][lib-build].

Key ideas:

  • We can currently only use a single Kotlin MPP library in an iOS project, so we need to create a MPP project local to our iOS XCode project whose sole purpose is to aggregate multiple MPP dependencies into a single Framework.
  • To keep our working environment clean, we create the gradle project in a subdirectory instead of at the root of our iOS XCode project. I name my subdirectory mpp.
  • We need to have the Frameworks used by our dependencies locally, as we only have bindings provided by the cinterop klibs, so we use [Carthage] again.
  • As the only goal of our gradle project is to create a Framework, we only use ios* targets.
  • Our project won't have any source code, but we NEED at least one source file, or Gradle will refuse to build anything, returning just a rude NO-SOURCE. Just create
@Ribesg
Ribesg / !README.md
Last active June 20, 2022 15:00
How to use an iOS Framework in a Kotlin MPP library published to Maven

This gist demonstrates how to build a Kotlin MPP library so that the iOS sourceSet depends on and uses an iOS Framework as a dependency.

Key ideas:

  • We use [Carthage] to retrieve/build the iOS Framework.
  • We use [cinterop] to create bindings allowing us to use the iOS Framework from Kotlin
  • We build and publish the library using ./gradlew publishToMavenLocal
  • We build and publish [klib] artifacts for both the arm64 and x86_64 architectures, you can easily add arm32 if you need.
  • Note that the publish process also publishes a cinterop klib artifact, allowing dependents to also know about the iOS Framework headers.

You can find a gist explaining how to use such library in an iOS app [here][ios-app].

@file:Suppress("NOTHING_TO_INLINE")
package org.jetbrains.anko
import android.app.Fragment
import android.view.View
/*
* This class must be named Dialogs2 to not override Anko.
*/
@Ribesg
Ribesg / fabric-beta-testers-scraper.js
Last active April 18, 2016 23:52
Use on the Beta tab of Fabric to get the list of beta testers as a CSV file. This code is GPLv3.
(function(){
function escapeCsvValue(str) {
var res = str;
if (res.indexOf('"') >= 0) {
res = res.replace(/"/g, '""');
}
if (res.indexOf('"') >= 0 || res.indexOf(' ') >= 0) {
res = '"' + res + '"';
}
@Ribesg
Ribesg / doge.kt
Last active August 29, 2015 14:22
import kotlin.platform.platformStatic as such
such fun wow() = println("very doge")

Keybase proof

I hereby claim:

  • I am Ribesg on github.
  • I am ribesg (https://keybase.io/ribesg) on keybase.
  • I have a public key whose fingerprint is 85F1 8AD6 F9F7 5AA6 09AF D81C 75A4 0E53 375E 1F43

To claim this, I am signing this object:

public
class
IAmDoingItWrong
{
public
static
void
main
(
String
automos:
priority: 0
flags:
- ENDERMANGRIEF
- EXPLOSION_BLOCK
- EXPLOSION_ITEM
- FIRE
- PVP
attributes:
EXPLOSION_BLOCK_DROP: 100
#####################################################################
## Config file for NPermissions plugin GROUPS ##
## If you don't understand something, please ask on dev.bukkit.org ##
## Ribesg ##
#####################################################################
# The group 'user', also defines the following permissions:
# - maingroup.user - For players for whom this group is the main group (unique per player)
# - group.user - For members of this group AND members of subgroups
# Members of this group also have the following permissions:
/***************************************************************************
* Project file: NPlugins - NCore - Filter.java *
* Full Class name: fr.ribesg.bukkit.ncore.common.logging.Filter *
* *
* Copyright (c) 2012-2014 Ribesg - www.ribesg.fr *
* This file is under GPLv3 -> http://www.gnu.org/licenses/gpl-3.0.txt *
* Please contact me at ribesg[at]yahoo.fr if you improve this file! *
***************************************************************************/
package fr.ribesg.bukkit.ncore.common.logging;