Hi all. Are there any plans to bring `WindowSizeCl...
# compose-ios
x
Hi all. Are there any plans to bring
WindowSizeClass
artifacts (
androidx.compose.material3:material3-window-size-class
) to commonMain? Would like to use this on the ios side, but looks like this is android-only so far
🙌 1
✅ 1
d
Thanks! Yeah, we can publish it with other material3 artifacts. But I think not on the next release. We need time to prepare this publication.
x
End up porting this myself for now. It was pretty straightforward with expect/actual
Copy code
// commonMain
@Suppress("ConvertSecondaryConstructorToPrimary") // To mirror android api
expect class WindowSizeClass {
  val widthSizeClass: WindowWidthSizeClass
  val heightSizeClass: WindowHeightSizeClass

  private constructor(
    widthSizeClass: WindowWidthSizeClass,
    heightSizeClass: WindowHeightSizeClass
  )
}

// androidMain
import androidx.compose.material3.windowsizeclass.WindowSizeClass

actual typealias WindowSizeClass = WindowSizeClass

// nonAndroidMain
actual typealias WindowSizeClass = CommonWindowSizeClass // basically copy-pasta of android implementation
Working sample here if anyone wants to take a look https://github.com/xxfast/NYTimes-KMP/pull/39