https://kotlinlang.org
Join Slack
Hi all Is there any way to modularize a KMM project? I want to follow the clean architecture so in t...
h

Hossein Amini

about 3 years ago
Hi all Is there any way to modularize a KMM project? I want to follow the clean architecture so in the bussiness layer I want to have 2 KMM modules. One for the data layer and the other one for the domain layer
h
b
a
  • 3
  • 36
  • 576
I’m trying to have a dynamic modal bottom sheet, based on the user selected ```var selectedUser: St...
o

Othman El Jazouli

about 3 years ago
I’m trying to have a dynamic modal bottom sheet, based on the user selected
var selectedUser: String? by remember {
   mutableStateOf(null)
}

ModalBottomSheetLayout(
    sheetState = sheetState,
    sheetContent = {
        selectedUser?.let {
            UserDetail(
                id = selectedUser, 
                onCloseClick = {
                    coroutineScope.launch {
                        sheetState.hide()
                        selectedUser = null
                    }
                }
            )
        } ?: Box(modifier = Modifier.fillMaxSize())
    },
) { 
... 
    coroutineScope.launch {
        selectedUser = "userid"
        sheetState.show()
    }
}
I added the default
Box
because otherwise there is an exception
java.lang.IllegalArgumentException: The initial value must have an associated anchor.
so my questions is do you guys think this is the right way of making a dynamic modal bottom sheet or is there a better way without going through the Box? (I know I could use scaffold but I don’t want interaction with the main screen)
o
h
+2
  • 4
  • 14
  • 576
Hey everyone, how can I access `Kotlin enum` from Swift
a

An Tran

about 3 years ago
Hey everyone, how can I access
Kotlin enum
from Swift
a
a
  • 2
  • 4
  • 576
How to set which iOS simulator to use for tests? I don’t have `iPhone 12` in my simulator list and `...
k

krzysztof

over 3 years ago
How to set which iOS simulator to use for tests? I don’t have
iPhone 12
in my simulator list and
iosX64Test
task fails with
Invalid device: iPhone 12
java.lang.IllegalStateException: command '/usr/bin/xcrun' exited with errors (exit code: 148)
☝️ 1
k
m
+2
  • 4
  • 6
  • 576
Hi all, I have a question, if `use cases` in `clean architecture` with Android are just calling `rep...
y

Yasser AKBBACH

about 3 years ago
Hi all, I have a question, if
use cases
in
clean architecture
with Android are just calling
repositories
, why should we bother creating them? why not injecting
repositories
in
viewmodels
like we used to do?!
y
j
+7
  • 9
  • 24
  • 576
I would like to have the `TextFieldColors` to apply the color for `onSecondary` instead of `onPrima...
l

Lilly

almost 4 years ago
I would like to have the
TextFieldColors
to apply the color for
onSecondary
instead of
onPrimary
. I tried with
TextStyle.color
or wrapping it in a Surface and setting contentColor but nothing works. The text/label/indicator color is always black. My
onSecodary
color is white.
Column(modifier = Modifier.padding(8.dp)) {
            TextField(
                modifier = Modifier.fillMaxWidth(),
                value = password,
                onValueChange = { password = it },
                label = { Text("Password") },
                visualTransformation = PasswordVisualTransformation(),
                keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
           )
}
Any ideas?
l
b
c
  • 3
  • 16
  • 576
Is is possible to make background blur effect in compose?
a

Ayla

over 2 years ago
Is is possible to make background blur effect in compose?
a
s
+3
  • 5
  • 11
  • 575
Hey folks, recently i bumped into a problem of `MonoCoroutine was cancelled`. Now i get it that whe...
a

Ansh Tyagi

almost 2 years ago
Hey folks, recently i bumped into a problem of
MonoCoroutine was cancelled
. Now i get it that when a coroutine is cancelled and we await, it will throw this JobCancellationExeception. For this i have done a standard try/catch method where i catch a CancellationException and it does not rethrow it. Now there are several reads i had over this topic. I want to have a public opinion on what are the best practices to handle this. Here is a code snippet:
val coroutineScope = CoroutineScope(<http://Dispatchers.IO|Dispatchers.IO>)
...
suspend func1() = withContext(coroutineScope.context) {
    val deferredJob1 = async { someFunctionWhichCanThrowException() } // consider this throws an exception
    val deferredJob2 = async { someFunction2WhichCanThrowException() }
    val job1 = job1.await()   // this will then throw a JobCancellationException
    val job2 = job2.await()
}
...
now this await() i replaced it with
safeAwait()
which is basically a try/catch block. My use case also have an awaitAll(), for which i have used
.map{ safeAwait() }
(ik its not optimised) thats why i wanna ask for a public opinion on whats the best practice to follow here?
a
s
a
  • 3
  • 6
  • 575
What is the easiest way to extend an `Map`? I tried extending `HashMap` but it is final. When I exte...
r

Robert

about 6 years ago
What is the easiest way to extend an
Map
? I tried extending
HashMap
but it is final. When I extend
Map
I have to implement all types of body functions like
containsKey
,
containsValue
,
get
,
isEmpty
and properties
entries
,
keys
,
size
and
values
r
a
+5
  • 7
  • 17
  • 575
The first alpha version of Android Jetpack Compose Liquid Glass library is released. It is relativel...
k

Kyant

4 months ago
The first alpha version of Android Jetpack Compose Liquid Glass library is released. It is relatively high performance. Check for details: https://github.com/Kyant0/AndroidLiquidGlass
K 9
📱 3
👏 5
🚀 18
k
k
+5
  • 7
  • 26
  • 575
Previous106107108Next

kotlinlang

A modern programming language that makes developers happier.

Powered by