https://kotlinlang.org
Join Slack
I wish the trailing-comma rule defaulted to adding a redundant trailing comma. It makes it easier to...
e

Emil Kantis

almost 3 years ago
I wish the trailing-comma rule defaulted to adding a redundant trailing comma. It makes it easier to add items later on, and such changes only shows a diff on the actual changed line. Basically just benefits of having the comma there. 🙂
e
s
p
  • 3
  • 9
  • 1156
Hi, I am using Kotlin Multiplatform to build iOS/Android App. Recently I just updated to Gradle 8.0....
j

Jan

about 2 years ago
Hi, I am using Kotlin Multiplatform to build iOS/Android App. Recently I just updated to Gradle 8.0.0 due update of AndroidStudio from Electric Eel to Flamingo. Starting the iOS Project from AndroidStudio is working fine. Right now I do have a problem to run my iOS Project from Xcode (14.3). Building the ios framework fails with: "Android Gradle plugin requires Java 17 to run. You are currently using Java 11. ... Your current JDK is located in /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home". I do not understand why XCode has a different JDK. In my .zshr file its defined like: export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jbr/Contents/Home and if I check ./gradlew -v it says: Gradle 8.0 ------------------------------------------------------------ Build time: 2023-02-13 131521 UTC Revision: 62ab9b7c7f884426cf79fbedcf07658b2dbe9e97 Kotlin: 1.8.10 Groovy: 3.0.13 Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021 JVM: 17.0.6 (JetBrains s.r.o. 17.0.6+0-17.0.6b802.4-9586694) OS: Mac OS X 13.0.1 aarch64 Why is gradle using a differnt JDK while running from xCode?
j
l
  • 2
  • 15
  • 1155
Fatal Exception: java.lang.IllegalStateException: LayoutNode should be attached to an owner
g

Gaurav Tyagi

over 2 years ago
Fatal Exception: java.lang.IllegalStateException: LayoutNode should be attached to an owner
g
a
  • 2
  • 4
  • 1155
I want to extract the array data from the json response and store the data in my custom data class. ...
t

T

about 5 years ago
I want to extract the array data from the json response and store the data in my custom data class.
data class NewsData (

    val author: String, val title: String,
    val url: String, val publishedAt: String
)
class NewsViewModel : ViewModel() {

    // The internal MutableLiveData String that stores the most recent response
    private val _response = MutableLiveData<String>()

    // The external immutable LiveData for the response String
    val response: LiveData<String>
        get() = _response

    /**
     * Call getNewsData() on init so we can display status immediately.
     */
    init {
        getNewsData()
    }

    /**
     * Sets the value of the status LiveData to the News API status.
     */
    private fun getNewsData() {

        _response.value = NewsApi.retrofitService.getProperties().enqueue(
            object : Callback<ResponseBody> {
                override fun onFailure(call: Call<ResponseBody>, t: Throwable) {
                    _response.value = "Failure: " + t.message
                    //Log.i("response", t.message)
                }

                override fun onResponse(call: Call<ResponseBody>, response: Response<ResponseBody>) {
                    val root = JSONObject(response.body().toString())
                    val jsonArr = root.getJSONArray("articles")
                    val ob = jsonArr.getJSONObject(0)
                    val name = ob.getString("author")
                    _response.value = name
                }
            }).toString()
    }
}
This is the format of the json response.
t
o
  • 2
  • 19
  • 1152
(I know it's more a Jackson than a Kotlin question, but I hope someone might have an answer anyway)....
n

nkiesel

about 3 years ago
(I know it's more a Jackson than a Kotlin question, but I hope someone might have an answer anyway). I have a line `val jackson: YAMLMapper = YAMLMapper.builder().addModule(KotlinModule()).build()`in my code to create a Jackson YAML mapper with Kotlin extensions. This tells me "Kotlin: 'constructor KotlinModule(Int = ..., Boolean = ..., Boolean = ..., Boolean = ..., SingletonSupport = ..., Boolean = ...)' is deprecated. Use KotlinModule.Builder instead of named constructor parameters". Does that really mean I should use `val jackson: YAMLMapper = YAMLMapper.builder().addModule(KotlinModule.Builder().build()).build()`instead? That's an awful amount of build...
n
e
m
  • 3
  • 7
  • 1150
Hi Team , Is it possible to use ConstraintLayout in Compose Multiplatofrm , i want to use for ios <@...
s

Shivam Kanodia

about 2 years ago
Hi Team , Is it possible to use ConstraintLayout in Compose Multiplatofrm , i want to use for ios @etolstoy?
s
n
+2
  • 4
  • 5
  • 1149
I'm really struggling to set up SQL Delight in a Compose Desktop project. This the reference I'm usi...
j

John Aoussou

almost 3 years ago
I'm really struggling to set up SQL Delight in a Compose Desktop project. This the reference I'm using but I can't quite follow: https://cashapp.github.io/sqldelight/jvm_sqlite/ , does anyone have another template? Please look in the thread to see what I have attempted.
j
h
+2
  • 4
  • 21
  • 1147
Hey guys, I want to run `debounce` on a flow from within a Composable. I get this warning Flow opera...
s

Shivam Dhuria

over 3 years ago
Hey guys, I want to run
debounce
on a flow from within a Composable. I get this warning Flow operator functions should not be invoked within composition . I am not using Viewmodels so can’t run the flow operator in the VM. Ideally I’d just want to call
debounce
on the
fullNameFlow
and trigger some changes in the composable. What’s the best way to go forward?
//This is inside a Composable
val fullNameFlow = MutableStateFlow("")
fullNameFlow.debounce(3000).mapLatest {
    Log.i(TAG,it)
    //Change Composable State
}

FormTextField(
    onValueChange = {
        fullNameFlow.value = it
    }
)
s
p
z
  • 3
  • 5
  • 1146
I am trying to make multi module project(kotlin) with gradle, i am not getting any reference on inte...
i

iamkdblue

over 4 years ago
I am trying to make multi module project(kotlin) with gradle, i am not getting any reference on internet , could you guys help with this?
i
a
  • 2
  • 9
  • 1146
what do you guys use to persist data in compose multiplatform? is there some library that does datas...
f

Fudge

12 months ago
what do you guys use to persist data in compose multiplatform? is there some library that does datastore on android, local storage on web, etc
f
k
+3
  • 5
  • 16
  • 1144
Previous282930Next

kotlinlang

A modern programming language that makes developers happier.

Powered by