Sunday, June 9, 2024
HomeiOS Developmentios - Wie behebe ich die Fehler

ios – Wie behebe ich die Fehler


Ich habe ein Code in Swift geschrieben und bekomme zwei Fehler wo ich nicht weiß wie ich sie beheben kann

Meine Dateien:

AppState:

import Basis

class AppState: ObservableObject {
    @Revealed var isLockedIn = false
}

ContentView:

import SwiftUI
import LocalAuthentication

struct LoginView: View {
    @State personal var unlocked = false
    @State personal var textual content = "Gespert"
    @EnvironmentObject var appState = AppState()
    var physique: some View {
        VStack {
            Textual content(textual content)
                .daring()
                .padding()
            Button("Entsperen") {
                authenticate()
            }
        }
    }
    
    func authenticate() {
        let context = LAContext()
        var error: NSError?
        
        if context.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) {
            context.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: "Das ist zum entsperren der App") {
                success, authenticatinError in 
                
                if success {
                    textual content = "ENTSPERT"
                    appState.isLockedIn = true
                    
                }else {
                    textual content = "ES GAB EIN PROBLEM"
                }
            }
        }else {
            textual content = "DAS GERET UNTERSTÃœTZT KEINE BIOMETRIE"
        }
    }
}

struct ContentView: View {
    var physique: some View {
        NavigationView {
            
            Checklist(0..<4) {
                _ in             
                NavigationLink(vacation spot: HabitDetail()) {
                    HabitItem()
                    }
                }
                .listStyle(InsetListStyle())
                .navigationTitle("Habits")
            }
    }                
}    

struct HabitItem: View {
    var physique: some View {
        VStack {
            HStack {
                Textual content("Behavior")
                Spacer()
                
            }
        }
    }
    
}

struct HabitDetail: View {
    @State personal var isOn = false
    var physique: some View {
        
            VStack {
                HStack {
                    Spacer()
                    EditButton()
                        .padding(10) 
                    NavigationLink(vacation spot: HabitCalender()) {
                        Picture(systemName: "calendar")
                            .padding(10)
                    }
                }
            }
            ScrollView {
                HStack{
                    Textual content("Aufgabe:")
                        .padding(10)
                    Spacer()
                    Textual content("")
                        .padding(10)
                }
                HStack{
                    Textual content("Beschreibung:")
                        .padding(10)
                    Spacer()
                    Textual content("")
                }
                HStack {
                    Textual content("Erledigt ?")
                        .padding(10)
                    Spacer()
                    Toggle(isOn: $isOn) {
                        Textual content("")
                    }
                    .toggleStyle(iOSCheckboxToggleStyle())
                    .padding(10)
                }
                HStack{
                    Textual content("5 Tage übersicht:")
                        .padding(10)
                    Picture(systemName: "sq.")
                    Picture(systemName: "sq.")
                    Picture(systemName: "sq.")
                    Picture(systemName: "sq.")
                    Picture(systemName: "sq.")
                    Picture(systemName: "sq.")
                    Picture(systemName: "sq.")
                    Spacer()
                }
                VStack {
                    ProgressView(worth: 0.5)
                        .padding(10)
                    HStack {
                        Textual content("Serie:")
                            .padding(10)
                        Spacer()
                        HStack {
                            Textual content("30")
                            Textual content("/  60")
                        }
                        .padding(10)
                        
                    }
                }
            }
        }
    
}

struct HabitCalender: View {
    var physique: some View {
        Textual content("Kommt Bald")
    }
}

struct iOSCheckboxToggleStyle: ToggleStyle {
    func makeBody(configuration: Configuration) -> some View {
        // 1
        Button(motion: {
            
            // 2
            configuration.isOn.toggle()
            
        }, label: {
            HStack {
                // 3
                Picture(systemName: configuration.isOn ? "checkmark.sq." : "sq.")
                
                configuration.label
            }
        })
    }
}

// MARK: - Preview
struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        LoginView()
    }
}

MyApp:

import SwiftUI

@fundamental
struct MyApp: App {
    
    @StateObject personal var appState = AppState()
    
    var physique: some Scene {
        WindowGroup {
            if !appState.isLockedIn {
                LoginView()
                    .environmentObject(appState)
            }else {
                ContentView()
            }
        }
    }
}

Die Fehler sind :
Argument handed to name that takes no argument
Und
Generic parameter Ë‹ObjectType ´ couldn’t inferred

Ich habe keine Ahnung was man probieren kann da ich relativ neu bei Swift bin



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments