Skip to content

BeamStudioHQ/BeamUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIT license Swift 5.9 supported Swift Package Manager compatible

Supports iOS 15+ Supports macOS 12+ Supports watchOS 8+ Supports tvOS 15+

BeamUI

a collection of SwiftUI components and utils

Installation

To install BeamUI you can follow the tutorial published by Apple using the URL for the BeamUI repo with the current version:

  1. In Xcode, select “File” → “Add Packages...”
  2. Enter https://github.com/Beam-Studio/BeamUI.git

or you can add the following dependency to your Package.swift:

.package(url: "https://github.com/Beam-Studio/BeamUI.git", from: "main")

Components

Marquee

An infinitely self-scrolling container.

Usage

Marquee(velocity: 20, spacing: 20) {
    Text(verbatim: "This is some infinitely scrolling text")
    Text(verbatim: "Here is another text because why not?")
}

Inspired by

Utils

View.measureHeight / measureWidth

A simple modifier to measure a view.

Beside being used in the Marquee component, you could use it to make a .sheet "fit" its content:

@State var sheetHeight: CGFloat? = nil

var sheetContent: some View {
    // ...
}

// ...

.sheet(isPresented: $sheetPresented, content: {
    sheetContent
        .measureHeight($sheetHeight)
        .presentationDetents([.height(sheetHeight ?? 0)])
        .presentationDragIndicator(.hidden)
})

String.unlocalized

You usually don't need to care too much about localization when prototyping. .unlocalized is your safe guard before sending your app to the stores:

  • when building in debug configurations, it has no effect.
  • when building in Release configurations, it will raise a warning for each call to .unlocalized, making it easy for developers to spot where localization work is left to do.

License

This project is released under the MIT license.