Skip to content

남녀노소 안드로이드 코딩 컨벤션

Jangjh edited this page Nov 16, 2023 · 11 revisions

Kotlin

기본적으로 Kotlin 에서 제공하는 코딩 컨벤션을 따릅니다.

Jetpack Compose

Modifier

Modifier 에 메서드를 두 번 이상 사용하는 경우, 다음과 같이 작성합니다.

  • 좋은 예
Box(
    modifier = modifier
        .clip(shape = RoundedCornerShape(8.dp))
        .fillMaxWidth()
    ) {
    ...
}
  • 나쁜 예
Box(
    modifier = modifier.clip(shape = RoundedCornerShape(8.dp)).fillMaxWidth()) {
    ...
}

Named-Parameter

엄격히 지키려 하지는 않지만, Named-Parameter 를 지향합니다. 두 개 이상의 파라미터를 작성해야 하는 경우, 줄 바꿈과 함께 Named-Parameter 를 사용해주세요.

  • 좋은 예
StyledText(
    modifier = Modifier.align(Alignment.Center),
    text = buttonText,
    style = Typography.labelLarge,
    color = if (isEnabled) Color.White else DisabledFontInDark
)

when Expression

when 을 사용할 때, 가능하면 항목 앞에 is 를 붙여주세요.

override fun event(event: UploadingVideoContract.Event) = when (event) {
    is UploadingVideoContract.Event.OnClickAddVideo -> {
            
    }
        
    is UploadingVideoContract.Event.OnClickSelectCategory -> {
            
    }
}

remember in Jetpack Compose

Composable 내부 상태 관리를 위한 remember 키워드 사용 시, 해당 변수의 값에 접근하는 경우가 많을 수 있으므로 백킹 프로퍼티를 지정하듯이 사용합니다.

val (playingState, _playingState) = remember { mutableStateOf(false) }

👪 남녀노소 Tech Blog

🤔 우리는 왜 이런 선택을 했는가?

🗣 Ground Rule

💃 MoveMove

🌱 Daily Scrum

1주차
2주차
3주차
4주차
5주차
6주차

✏️ MoveMove 개발 일지

김민조

장지호

조준장

장민석

하채리

🐣 개인회고

김민조
장지호
조준장
장민석
하채리

🐥 팀회고

Clone this wiki locally