Skip to content

Instantly share code, notes, and snippets.

View GMetaxakis's full-sized avatar
🤓
Transition from kotlin to swift, isn't that hard, but xCode is terrible!

Georgios Metaxakis GMetaxakis

🤓
Transition from kotlin to swift, isn't that hard, but xCode is terrible!
View GitHub Profile
NavHost(navController = navController, startDestination = "profile"){
composable(route="profile") { Profile(navController) }
composable(route="friendslist") { FriendsList(navController) }
composable(route="friendprofile/{profile}", /**/) {
FriendProfile(navController, profile)
}
}
@Composable
fun Profile(navController: NavController){/*...*/}
@GMetaxakis
GMetaxakis / FriendProfileNavigation.kt
Created May 20, 2022 06:12
Navigate to friend profile
/*…*/
@Composable
fun Profile(navController: NavController) {
/*...*/
Button(onClick = {
val profile = Profile("Joe", "Doe")
navController.navigate("friendprofile/${profile}")
}) {
Text(text = "Navigate to Joe Doe")
}
@GMetaxakis
GMetaxakis / Profile.kt
Last active May 20, 2022 06:21
Profile & ProfileArgType
data class Profile(val firstName:String, val lastName:String){
override fun toString(): String = Uri.encode(Gson().toJson(this))
}
class ProfileArgType : JsonNavType<Profile>() {
override fun fromJsonParse(value: String): Profile = Gson().fromJson(value, Profile::class.java)
override fun FromProfileArguments.getJsonParse(): String = Gson().toJson(this)
}
//Discaimer : Gson or Moshi or any other library is up to you
@GMetaxakis
GMetaxakis / JsonNavType.kt
Created May 20, 2022 05:52
JsonNavType for passing json as navtype in JeptackNavigation Compose
abstract class JsonNavType<T> : NavType<T>(isNullableAllowed = false) {
abstract fun fromJsonParse(value: String): T
abstract fun T.getJsonParse(): String
override fun get(bundle: Bundle, key: String): T? =
bundle.getString(key)?.let { parseValue(it) }
override fun parseValue(value: String): T = fromJsonParse(value)
override fun put(bundle: Bundle, key: String, value: T) {
@GMetaxakis
GMetaxakis / push.yml
Last active September 5, 2021 16:52
Phrase Push
name: "Phrase push"
on:
pull_request:
types: [ closed ]
branches: [ develop ]
jobs:
phrase_push_create_job:
@GMetaxakis
GMetaxakis / pull.yml
Last active April 6, 2021 18:41
Phrase Pull
name: "pull"
on:
schedule:
- cron: "0 10 * * 4"
jobs:
pull:
runs-on: ubuntu-latest