Skip to content
Weather Header preview
Rendered from the SwiftUI source on this page.

Weather Header

From syxUI — written for both platforms, not translated between them.

A weather header - location, condition and a large temperature.

Navigation · SwiftUI · iOS 17

  • navigation
  • swiftui

The actual source

HeaderWeather.swift
// Weather Header · syxUI · https://syxui.dev/components/hdr-weather
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Weather header - location + big temp
struct HeaderWeather: View {
    var body: some View {
        HStack(alignment: .top) {
            VStack(alignment: .leading, spacing: 2) {
                Text("San Francisco").font(.system(size: 20, weight: .semibold))
                Text("Mostly Sunny").font(.system(size: 13)).foregroundStyle(.secondary)
            }
            Spacer()
            HStack(alignment: .top, spacing: 0) {
                Text("72").font(.system(size: 44, weight: .thin))
                Text("°").font(.system(size: 24, weight: .thin))
            }
        }.frame(width: 340)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17