글
개발환경 : Xcode 12.1
시작하기 전에 Widget 자체에 대해서 궁금하시다면
[ios][swiftUI][WidgetKit] home screen widget(widget)기능 구현하기
개발환경 : Xcode 12.0.1 1. wigetkit이란? ios14부터 홈 화면에 widget을 넣을 수 있다. app이 가진 정보를 app을 열지 않고도 보여주고(일부) 필요할 경우 app을 실행해서 할 일 할 수 있게 해주는 정도의 기
bmwe3.tistory.com
Widget Configuration을 2가지로 나눌 수 있다.
developer.apple.com/documentation/widgetkit/creating-a-widget-extension
Apple Developer Documentation
developer.apple.com
StaticConfiguration은 홈에 설정된 위젯의 내용에 대한 변경 기능을 제공하지 않는 것이고
예시.
IntentConfiguration은 위젯 변경 (Edit Widget)을 제공하는 것이다.
예시 - Edit Widget이 보인다.
만들 위젯 혹은 앱 데이터의 성향에 따라서 결정하면 된다.
어떤 Configuration을 설정할지는 "Target"추가 화면에서 "Include Configuration Intent"를 클릭하면 IntentConfiguration가,
클릭을 해제하면 StaticConfiguration가 설정되게 된다.
만들 때 무엇을 선택하더라도 변경이 쉬우므로 크게 고민하지 않아도 된다.
차이점은 Widget 생성자와 TimelineProvider가 무엇을 상속받느냐의 일뿐이다.
StaticConfiguration | IntentConfiguration | |
생성자 | ![]() |
![]() |
TimelineProvider |
TimelineProvider |
IntentTimelineProvider |
intentdefinition file | X | O |
IntentConfiguration으로 만든 앱이라면 다음과 같이 intentdefinition file에서 parameter을 추가해줄 수 있다.
해당 parameter는 위젯 편집 으로 진입해서 값을 수정할 수 있게 된다.
![]() |
![]() |
RECENT COMMENT