Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Threema/ThreemaFramework/SharedUI/   (Social Medium ©)  Datei vom 26.9.2026 mit Größe 2 kB image not shown  

Quelle  Button+Extension.swift   Sprache: JAVA

 

import Foundation
import SwiftUI
import ThreemaMacros

public struct XMarkCancelButton: View {
    private let action: () -> Void

    public init(action: @escaping () -> Void) {
        self.action = action
    }
    
    public var body: some View {
        if #available(iOS 26.0, *) {
            Button(role: .close) {
                action()
            }
        }
        else {
            Button(role: .cancel) {
                action()
            } label: {
                Label(#localize("done"), systemImage: "xmark.circle.fill")
                    .symbolRenderingMode(.hierarchical)
                    .foregroundColor(.secondary)
            }
        }
    }
}

public struct DoneButton: View {
    private let action: () -> Void
    
    public init(action: @escaping () -> Void) {
        self.action = action
    }
    
    public var body: some View {
        if #available(iOS 26.0, *) {
            Button(role: .close) {
                action()
            }
        }
        else {
            Button(#localize("done")) {
                action()
            }
            .bold()
        }
    }
}

public struct CancelButton: View {
    private let action: () -> Void
    
    public init(action: @escaping () -> Void) {
        self.action = action
    }
    
    public var body: some View {
        if #available(iOS 26.0, *) {
            Button(role: .cancel) {
                action()
            }
        }
        else {
            Button(#localize("cancel")) {
                action()
            }
        }
    }
}

public struct CloseButton: View {
    private let action: () -> Void
    
    public init(action: @escaping () -> Void) {
        self.action = action
    }
    
    public var body: some View {
        if #available(iOS 26.0, *) {
            Button(role: .cancel) {
                action()
            }
        }
        else {
            Button(#localize("close")) {
                action()
            }
        }
    }
}

public struct SendButton: View {
    private let action: () -> Void
    
    public init(action: @escaping () -> Void) {
        self.action = action
    }
    
    public var body: some View {
        if #available(iOS 26.0, *) {
            Button(#localize("send"), systemImage: "arrow.up") {
                action()
            }
            .labelStyle(.iconOnly)
        }
        else {
            Button(#localize("send")) {
                action()
            }
        }
    }
}

public struct ConfirmationButton: View {
    private let title: String
    private let action: () -> Void
    
    public init(title: String, action: @escaping () -> Void) {
        self.title = title
        self.action = action
    }
    
    public var body: some View {
        if #available(iOS 26.0, *) {
            Button(role: .confirm) {
                action()
            }
        }
        else {
            Button(title) {
                action()
            }
        }
    }
}

Messung
CHZG
801009290

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.