Sobes.tech

iOS

Perché l'interfaccia utente si visualizzava correttamente prima di aggiungere una dispatch esplicita sul thread principale?

Senior
Uzum
55

Parla di risorse interessanti per lo sviluppo — canali YouTube, canali Telegram, community, strumenti

Senior
Salmon
55

Perché aggiungere un mutex solo per la scrittura non risolve il problema della race condition? Come usare correttamente un mutex per proteggere una variabile condivisa?

Principal
Позитив Технолоджис
54

Devi scrivere una libreria semplice di cache in memoria. type Cache interface { Set(k, v string) Get(k string) (v string, ok bool) }

Principal
Позитив Технолоджис
54

Come funziona il sistema di progettazione tra UIKit e SwiftUI — ci sono duplicazioni di componenti o wrapper?

Senior
Salmon
52

func getCarPrice() int64 { time.Sleep(1 * time.Second) return rand.Int63n(1000) } func main() { http.HandleFunc("/car/instant", func(resp http.ResponseWriter, req *http.Request) { fmt.Fprintf(resp, "%d", 0) }) http.ListenAndServe(":8080", nil) }

Principal
Позитив Технолоджис
50

Ci sono problemi, soluzioni temporanee o limitazioni relative a SwiftUI con l'obiettivo iOS 16 rispetto a iOS 15?

Senior
Salmon
49

struct ExampleView: View { var body: some View { VStack { FormView() Button("Reset") { // TODO: } } } } // SOLO LETTURA struct FormView: View { @State private var firstname = "" @State private var lastname = "" @State private var email = "" @State private var website = "" var body: some View { Form { TextField("Enter firstname", text: self.$firstname) TextField("Enter lastname", text: self.$lastname) TextField("Enter email address", text: self.$email) TextField("Enter website address", text: self.$website) } } }

Senior
Salmon
48

Array { value1 value2 if condition { value3 } }

Senior
Salmon
47

classe finale ProfileViewModel1 { enum Stato { ... } var stato: Stato = .idle let servizio: UserService init(servizio: UserService) { ... } func onBackPress() { // vista deinit } func loadUser() { stato = .loading Task { [weak self] guard let self else { return } do { let utente = try await self.servizio.fetchUser() self.stato = .loaded(utente) } catch { self.stato = .failed(error.localizedDescription) } } } }

Senior
Salmon
47

Perché il codice attuale con un ciclo infinito for in main non funziona? Come correggerlo?

Principal
Позитив Технолоджис
46

Come è stata implementata l'interazione con i gesti e lo zoom nella galleria fotografica — in UIKit o SwiftUI?

Senior
Salmon
44

Quale versione del linguaggio Swift viene utilizzata nel progetto: superiore a 6 o inferiore?

Senior
Salmon
42

lascia che il genitore sia Task { let child = Task { print("figlio avviato, isCancelled = ", Task.isCancelled) // for index in (1...[phone]) { print(index) } print("figlio terminato, isCancelled = ", Task.isCancelled) // } await child.value } try? await Task.sleep(nanoseconds: 1_000_000_000) // 1 secondo parent.cancel()

Senior
Salmon
42

La navigazione è scritta in UIKit, e gli alert/sheet vengono gestiti in UIKit o usi i mezzi nativi di SwiftUI?

Senior
Salmon
41

struct ExampleView: View { @State var isVariant1 = true var body: some View { VStack { Toggle("Usa Variante 1", isOn: $isVariant1.animation(.linear)) Text(isVariant1 ? "Variante 1" : "Variante 2") } .padding() } } Variante1 -> scala -> 1 -> 0 Variante2 -> scala -> 0

Senior
Salmon
41

Utilizzi l'architettura Viper per UIKit? Si applica a tutte le applicazioni?

Senior
Salmon
41

Qual è il target minimo di iOS attualmente nel progetto?

Senior
Salmon
39

protocol SomeProtocol {} func test1_1(valore: SomeProtocol) {} func test1_2(valore: qualsiasi SomeProtocol) {} func test2_1(valore: some SomeProtocol) {} func test2_2<Valore: SomeProtocol>(valore: Valore) {} classe A { func test2_2<Valore: SomeProtocol>(valore: Valore) { } } classe B: SomeProtocol { } A().test2_2(valore: B())

Senior
Salmon
39

Come comunicano View e ViewModel in UIKit — si utilizza qualcosa come RxSwift/Combine per i binding?

Senior
Salmon
38
/206