Skip to content

simonberner/monthly-theme-widget

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Monthly Theme Widget

mastodon.green/@simonberner Gitmoji Conventional Commits

A small project to learn the fundamentals of how to create a simple Widget with an intent and configuration for iOS 17+.


Contents


Functionality

A simple Date Widget that changes the day at midnight and its theme every month. With iOS17+ it is also available in the StandBy mode.

Tech Stack

  • Xcode 15.0
  • Swift 5.9

Frameworks

  • SwiftUI
  • WidgetKit

Device Compatibility

  • iPhone with iOS 17+
  • iPad with iOS 17+

Screenshots

Widget Normal Font Intent
Configuration Widget Fun Font
StandBy Mode (iOS17)
Different Days Overview

Learnings

  • A Widget comes in 4 "fixed" sizes: systemSmall, systemMedium, systemLarge, systemExtraLarge
  • The shape of a Widget is given
  • The content of a widget can only be implemented with SwiftUI (no UIKit)
  • The IntentTimelineProvider creates the timeline of the widget when to update its content:
    • placehoder: dummy data (in case there is no data from the snapshot eg. network call needed)
    • getSnapshot: how does the widget look right now (this state is shown in the widget gallery)
    • getTimeline: this is where the timeline actually gets created. It consists of an Array of entries (the data)

Fonts

Widget Intent & Configuration

    1. Create a intent definition file add some intents with parameters
    1. Add the IntentConfiguration to the Widget, which then takes in a IntentTimelineProvider

Code Comments

I love putting in the effort of adding comments to my code, here is why.

Pull Requests

When I create PRs I stick to this guideline.

FAQ

Whats new for this App with iOS17?

  • App Intents for Widget-Configuration and interactive Widgets

Why is this App iOS17+ only?

  • Because I want to be able the new way of implementing App Intents in code rather than using the SiriKit definition file (prior to iOS17).
  • Because I don't want to fidle around with if #available(iOS 17, *) {...}

Credits

πŸ™πŸ½ Sean Allen iOS Courses


Made with a πŸ™‚ Simon Berner

About

An iOS17+ Monthly Theme Widget πŸ“…

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages