https://kotlinlang.org
Join Slack
I am trying to write SocketIO wrapper to use in common code. I want to use `expect/actual` to do it....
h

Hasan Nagizade

over 2 years ago
I am trying to write SocketIO wrapper to use in common code. I want to use
expect/actual
to do it. I have an interface like this is
commonMain
expect interface ChatSocketService {

    suspend fun initialize(token: String, endpoint: String, broadcastUrl: String) : Resource<Unit>

    suspend fun emitEvent(event: Events, ids: ArrayList<Int>, chatKey: String)

    fun observeMessages() : Flow<SocketResponse>

    suspend fun closeSession()
}
Implementing this in
androidMain
is not a problem. It's the
iosMain
implementation that's causing problem. I can't import the native ios socket io client into
iosMain
module. Two questions. First how can I import native ios SocketIO library into
iosMain
and second question is if I will write native iOS code to handle socket io and put that class inside
iosMain
how can I import that into my
actual
implementation ?
h
p
+2
  • 4
  • 43
  • 439
Is there a way to get `FlowRow` to apply `SpaceBetween` on all rows except the last one? Ideally th...
m

Mark

almost 3 years ago
Is there a way to get
FlowRow
to apply
SpaceBetween
on all rows except the last one? Ideally there would be an extra optional arg:
lastRowHorizontalArrangement: Arrangement.Horizontal = horizontalArrangement,
🚫 1
m
o
j
  • 3
  • 10
  • 439
how to popBackStack with popUpTo ?
h

Hasan Nagizade

almost 3 years ago
how to popBackStack with popUpTo ?
h
f
  • 2
  • 28
  • 439
I would like to retrieve response body message for a given 400 status code when using the spring web...
y

Yogeshvu

about 3 years ago
I would like to retrieve response body message for a given 400 status code when using the spring webclient. However, I can only find the error code and not the actual error message contained in the code. I am using following snippet. how to actually extract the response body in the 400 status response .
val retrievedResource: Mono<String> = myRequest
            .retrieve()
            .onStatus(HttpStatus::is4xxClientError) { Mono.error(RuntimeException("4XX Error ${it.statusCode()}, ${it.bodyToMono(String::class.java)}")) }
            .onStatus(HttpStatus::is5xxServerError) { Mono.error(RuntimeException("5XX Error ${it.statusCode()}, ${it.bodyToMono(String::class.java)}")) }
        .bodyToMono(String::class.java)
        return retrievedResource.share().block()
y
g
  • 2
  • 3
  • 439
I'm using a BasicTextField with an annotated string to make a rudimentary rich text editor. However...
b

Brendan Campbell-hartzell

over 3 years ago
I'm using a BasicTextField with an annotated string to make a rudimentary rich text editor. However, the styles keep getting removed whenever the value is updated via the onValueChange callback. Am I missing something about the functionality of the BasicTextField? Code in thread.
b
a
  • 2
  • 5
  • 439
how can i use ssl with raw sockets?
o

otakusenpai

over 7 years ago
how can i use ssl with raw sockets?
✅ 1
📋 1
📝 1
o
d
e
  • 3
  • 40
  • 439
Anyone tried the <new CentralPortal API>? I keep getting the below even if my .zip has a pom inside ...
m

mbonnin

almost 2 years ago
Anyone tried the new CentralPortal API? I keep getting the below even if my .zip has a pom inside
Bundle has content that does NOT have a .pom file
m
a
l
  • 3
  • 9
  • 438
A quick (spoiler, its not quick) question on SkieSwiftFlow, at the moment there is no nice way to ge...
a

Andrew Reed

about 2 years ago
A quick (spoiler, its not quick) question on SkieSwiftFlow, at the moment there is no nice way to get a flow to play nicely with SwiftUI? like you get out of the box with Compose. For example in compose, i would usually do something like:
@Compose
fun coolView(viewModel: CoolViewModel) {
val coolValue = viewModel.fooFlow.collectAsState()
....
Whereas in swift, really i would like to be able to do something like this:
struct CoolView: View {
let viewModel: CoolViewModel
@State var coolValue = viewModel.fooFlow.collectAsState()
....
I was just wondering if anybody came up with a smart extension for this?
extension SkieSwiftFlow {
    func collectValue(callback: @escaping (_ value: T) -> Void) {
        Task.init {
           for await awaitedValue in self {
               callback(awaitedValue)
           }
        }
    }
}
Then you could. do something like:
struct CoolView: View {
let viewModel: CoolViewModel
@State var coolValue: Bool = false
init (viewModel: CoolViewModel) {
   self.viewModel = viewModel
   viewModel.fooFlow.collectValue {
      self.coolValue = $0
   }
}
....
Sorry for the essay, but how else do people collect values from the SKIE flow? i saw the mainActor stuff, but it would be noisy for lots of values, unless you created your own wrapper viewmodel and did it there but im a beleiver that the Kotlin generated view model should be useable from native without a wrapper.
a
s
+3
  • 5
  • 21
  • 438
hi, I'm experimenting with referencing a KMM framework from within an iOS framework, I'm running `./...
c

Cristina Suciu

about 3 years ago
hi, I'm experimenting with referencing a KMM framework from within an iOS framework, I'm running
./gradlew :shared:embedAndSignAppleFrameworkForXcode
script at pre-compile time on the framework's project file and I'm getting this runtime error: dyld[87584]: Library not loaded: @rpath/shared.framework/shared I'm following this documentation https://kotlinlang.org/docs/multiplatform-mobile-integrate-in-existing-app.html#connect-the-framework-to-your-ios-project does anyone know what other build settings I'm missing here?
c
s
+2
  • 4
  • 11
  • 438
how to get screen width and screen height in a composable function?
s

Socheat KHAUV

over 5 years ago
how to get screen width and screen height in a composable function?
s
a
+2
  • 4
  • 5
  • 438
Previous153154155Next

kotlinlang

A modern programming language that makes developers happier.

Powered by