Skip to content

fix : 라이브액티비티 expanded·락스크린 타이머 HH:MM:SS 포맷으로 통일#129

Merged
peisonger merged 1 commit into
mainfrom
fix/live-activity
Jun 5, 2026
Merged

fix : 라이브액티비티 expanded·락스크린 타이머 HH:MM:SS 포맷으로 통일#129
peisonger merged 1 commit into
mainfrom
fix/live-activity

Conversation

@peisonger

Copy link
Copy Markdown
Contributor

Summary

라이브액티비티 expanded·락스크린 타이머 HH:MM:SS 포맷으로 통일(기존: 1시간 미만 시 MM:SS)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the native system-clock-based timer in the Live Activity widgets with a custom TimelineView that updates every second. The reviewer raised critical concerns regarding this change, noting that using TimelineView in a Live Activity can cause system throttling, timer freezing (especially on Always-On Display), and increased battery consumption. Additionally, the change introduces code duplication for text styling modifiers. The reviewer recommends reverting to the native .timer style to ensure reliability and battery efficiency.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +36 to +45
let startDate = Date(timeIntervalSince1970: epoch / 1000)
TimelineView(.periodic(from: .now, by: 1.0)) { tl in
let elapsed = max(0, Int(tl.date.timeIntervalSince(startDate)))
Text(formatExpanded(elapsed))
.font(.custom("Lexend-SemiBold", size: fontSize))
.kerning(kerning)
.foregroundColor(C.timerGreen)
.minimumScaleFactor(0.6)
.lineLimit(1)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

⚠️ Live Activity 내 TimelineView 사용에 따른 성능 및 동작 신뢰성 이슈

TimelineView(.periodic(from: .now, by: 1.0))를 사용하여 매초마다 뷰를 업데이트하는 방식은 Live Activity(라이브 액티비티)에서 다음과 같은 심각한 문제를 유발할 수 있습니다.

  1. 시스템 스로틀링(Throttling) 및 타이머 멈춤 현상
    iOS는 배터리 절약을 위해 백그라운드 및 잠금 화면(특히 Always-On Display 상태)에서 WidgetKit의 렌더링 빈도를 엄격하게 제한합니다. 이로 인해 TimelineView가 매초마다 실행되지 않고 타이머가 멈추거나 초 단위가 건너뛰는 현상이 발생하여 사용자 경험을 해칠 수 있습니다.

  2. 배터리 소모 증가
    매초마다 뷰를 다시 그리는 작업은 시스템 리소스를 지속적으로 소모하게 만듭니다. 기존의 Text(Date, style: .timer) 방식은 시스템이 자체적으로 렌더링을 최적화하여 처리하므로 배터리 소모가 거의 없습니다.

  3. 코드 중복 발생
    TimelineView가 도입되면서 Group 내부에 Text가 아닌 일반 View가 포함되게 되었습니다. 이로 인해 Text 전용 모디파이어인 .kerning을 더 이상 공통 Group에 적용할 수 없게 되어, 각 분기(if/else)의 Text마다 모든 모디파이어를 중복해서 작성해야 하는 구조적 단점이 발생했습니다.

💡 제안
HH:MM:SS 포맷 통일이라는 시각적 요구사항보다 타이머의 정확성과 배터리 효율성이 더 중요하다면, 기존의 네이티브 타이머 스타일(style: .timer)을 유지하는 것을 강력히 권장합니다. 만약 기획상 포맷 통일이 필수적이라면, 위에서 언급한 스로틀링 및 배터리 소모 트레이드오프를 충분히 인지하고 진행해야 합니다.

Comment on lines +36 to +45
let startDate = Date(timeIntervalSince1970: epoch / 1000)
TimelineView(.periodic(from: .now, by: 1.0)) { tl in
let elapsed = max(0, Int(tl.date.timeIntervalSince(startDate)))
Text(formatExpanded(elapsed))
.font(.custom("Lexend-SemiBold", size: fontSize))
.kerning(kerning)
.foregroundColor(C.timerGreen)
.minimumScaleFactor(0.6)
.lineLimit(1)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

⚠️ Live Activity 내 TimelineView 사용에 따른 성능 및 동작 신뢰성 이슈

TimelineView(.periodic(from: .now, by: 1.0))를 사용하여 매초마다 뷰를 업데이트하는 방식은 Live Activity(라이브 액티비티)에서 다음과 같은 심각한 문제를 유발할 수 있습니다.

  1. 시스템 스로틀링(Throttling) 및 타이머 멈춤 현상
    iOS는 배터리 절약을 위해 백그라운드 및 잠금 화면(특히 Always-On Display 상태)에서 WidgetKit의 렌더링 빈도를 엄격하게 제한합니다. 이로 인해 TimelineView가 매초마다 실행되지 않고 타이머가 멈추거나 초 단위가 건너뛰는 현상이 발생하여 사용자 경험을 해칠 수 있습니다.

  2. 배터리 소모 증가
    매초마다 뷰를 다시 그리는 작업은 시스템 리소스를 지속적으로 소모하게 만듭니다. 기존의 Text(Date, style: .timer) 방식은 시스템이 자체적으로 렌더링을 최적화하여 처리하므로 배터리 소모가 거의 없습니다.

  3. 코드 중복 발생
    TimelineView가 도입되면서 Group 내부에 Text가 아닌 일반 View가 포함되게 되었습니다. 이로 인해 Text 전용 모디파이어인 .kerning을 더 이상 공통 Group에 적용할 수 없게 되어, 각 분기(if/else)의 Text마다 모든 모디파이어를 중복해서 작성해야 하는 구조적 단점이 발생했습니다.

💡 제안
HH:MM:SS 포맷 통일이라는 시각적 요구사항보다 타이머의 정확성과 배터리 효율성이 더 중요하다면, 기존의 네이티브 타이머 스타일(style: .timer)을 유지하는 것을 강력히 권장합니다. 만약 기획상 포맷 통일이 필수적이라면, 위에서 언급한 스로틀링 및 배터리 소모 트레이드오프를 충분히 인지하고 진행해야 합니다.

@peisonger peisonger merged commit 8b2f000 into main Jun 5, 2026
2 checks passed
@peisonger peisonger deleted the fix/live-activity branch June 5, 2026 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants