Back to blog

Tuesday, April 8, 2025

ComponentsKit v1.5.0

Read time: 6 min

ComponentsKit v1.5.0

What’s New in ComponentsKit v1.5.0

We’re excited to introduce ComponentsKit v1.5.0, a fresh update to our open-source UI component library for iOS. This version introduces a new component, API refinements, theming improvements, and important bug fixes — all aimed at improving your experience building iOS UIs with SwiftUI and UIKit.

New UI Component: Circular Progress

Introducing the Circular Progress component — ideal for displaying progress indicators or loading states in a compact, visually appealing way. It's available for both SwiftUI and UIKit, and fully customizable to match your app’s design.

Circular progress example

Use it to indicate background tasks, content loading, or percentage-based actions with smooth animations and minimal setup.

API Enhancements

We’ve made several updates to improve how you work with ComponentsKit components in your iOS projects:

  • UKCard is now generic over Content, allowing you to access properties of the wrapped view without type casting.
  • Progress bar components (SUProgressBar, UKProgressBar) have moved the currentValue property to ProgressBarVM, improving clarity and state management.
  • SUAlert can now be presented using a new item-based API, making it easier to show alerts conditionally in SwiftUI.
  • Color customization has been streamlined with new UniversalColor extensions for easier access to ComponentColor subcolors.

Theming Improvements

We’ve made two key changes to improve theming:

  1. ComponentsKitConfig has been renamed to Theme for better clarity and alignment with its purpose.
  2. We’ve added new helper methods to make it easier to observe and respond to theme updates.

For SwiftUI apps, you can use ThemeChangeObserver to automatically refresh views when the theme updates. We recommend using this helper in the root of your app to redraw everything at once.

@main
struct Root: App {
  var body: some Scene {
    WindowGroup {
      ThemeChangeObserver {
        Content()
      }
    }
  }
}

For UIKit apps, use the observeThemeChange(_:) method to update elements that depend on the properties from the library.

override func viewDidLoad() {
  super.viewDidLoad()

  style()

  observeThemeChange { [weak self] in
    guard let self else { return }
    self.style()
  }
}

func style() {
  view.backgroundColor = UniversalColor.background.uiColor
  button.model = ButtonVM {
    $0.title = "Tap me"
    $0.color = .accent
  }
}

If you are not using the built-in helpers, you can listen for theme change notifications and manually update the UI:

NotificationCenter.default.addObserver(
  self,
  selector: #selector(handleThemeChange),
  name: Theme.didChangeThemeNotification,
  object: nil
)

@objc private func handleThemeChange() {
    view.backgroundColor = UniversalColor.background.uiColor
}

But don't forget to remove the observer when the view is deallocated:

deinit {
    NotificationCenter.default.removeObserver(self, name: Theme.didChangeThemeNotification, object: nil)
}

Bug Fixes & Improvements

  • Text Input:

    • Improved corner radius calculations for more consistent styling.
    • Automatically adjusts height on device rotation.
    • Improved layout handling under compression.
  • Updated font size for the large headline from 28 to 24.

  • Expanded documentation to help you get started and customize components faster.

  • Fixed an issue where modals failed to present on initial app launch.

  • Resolved a bug in UKSegmentedControl that allowed selection of disabled items.

  • Addressed layout issues with modals.

Update to the latest version now

This release makes ComponentsKit more powerful, developer-friendly, and production-ready for your next iOS app. Whether you're using SwiftUI, UIKit, or a combination of both, these updates aim to make building interfaces faster and more maintainable.

👉 Get started with ComponentsKit today!