SPB Git

Repository Public MIT

GlassTextAreaExample.swift 2.8 KB 76 lines swift

1// =============================================================================2//                  SP BOUCHER | SOFTWARE & RESEARCH3//             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// Project          : SP GlassKit7// File             : Examples/Gallery/Forms/GlassTextAreaExample.swift8// Module           : Examples9// Repository       : https://git.spboucher.ai/sp-glasskit10// Project Website  : https://glass.spboucher.ai11// Created          : 2026-12-0212// Last Modified    : 2026-12-0213//14// Author           : Simon-Pierre Boucher15// Position         : Professor of Finance16// Institution      : Université du Québec en Outaouais (UQO)17// Organization     : SP Boucher18// Website          : https://spboucher.ai19// Git              : https://git.spboucher.ai20//21// Preferred Contact: contact@spboucher.ai22// Development      : dev@spboucher.ai23// Support          : support@spboucher.ai24// Security/Admin   : admin@spboucher.ai25//26// Copyright (c) 202627// Simon-Pierre Boucher28// All rights reserved where applicable. This file is governed by the29// applicable project license, copyright notices and relevant law.30// Existing third-party rights and notices remain unaffected.31//32// License          : MIT33//34// Do not embed credentials, private keys, access tokens,35// certificates or confidential personal information.36//37// =============================================================================38// END OF SP BOUCHER SOURCE HEADER39// =============================================================================4041import SwiftUI42import SPGlassKit4344public struct GlassTextAreaExample: GlassExample {45    public static let componentID = "glass-text-area"46    @State private var notes = ""47    @State private var bio = "Hiking 🥾, bread 🍞 and old maps 🗺️."48    @State private var feedback = "Too short"4950    public init() {}5152    public var body: some View {53        ScrollView {54            VStack(alignment: .leading, spacing: 20) {55                GlassTextArea("Notes", text: $notes, placeholder: "Anything the team should know before the visit", helper: "Visible to your team only.")5657                GlassTextArea("Short bio", text: $bio, limit: 40)5859                GlassTextArea(60                    "Feedback",61                    text: $feedback,62                    showsCounter: true,63                    minHeight: 72,64                    errorMessage: feedback.count < 20 ? "Please write at least 20 characters." : nil65                )6667                GlassTextArea("Archived comment", text: .constant("This comment can no longer be edited."))68                    .disabled(true)69            }70            .padding()71        }72    }73}7475#Preview("GlassTextArea") { GlassTextAreaExample().glassTheme(.solar) }76
Files main
Menu

Theme