laske, et vanem oleks Töö { lase, et laps oleks Töö { print("child started, isCancelled = ", Task.isCancelled) // EI false for index in (1...[phone]) { print(index) } print("child finished, isCancelled = ", Task.isCancelled) // } await child.value } try? await Task.sleep(nanoseconds: 1_000_000_000) // 1 sekund parent.cancel() /////// laske, et vanem oleks Töö { async let child: Void = { print("child started, isCancelled =", Task.isCancelled) for index in (1...[phone]) { print(index) } print("child finished, isCancelled =", Task.isCancelled) }() await child } try? await Task.sleep(nanoseconds: 1_000_000_000) // 1 sekund parent.cancel()
iOS
Kas oli probleeme konkurentsivõimega (Sendable, unchecked Sendable, üleminek aktorite vahel) modulites, millega otseselt töötasite?
protokoll SomeProtocol {} funktsioon test1_1 väärtus: SomeProtocol {} funktsioon test2_1 väärtus: some SomeProtocol {} funktsioon test1_2 väärtus: any SomeProtocol {}
Kuidas töötab disainisüsteem UIKit ja SwiftUI vahel — kas on komponente või katteid dubleeritud?
Räägi mulle oma viimase projekti kohta rohkem — Avito fotogalerii moodul, mille eest vastutasid (lühiajaline rent, broneerimisvorm jne.)
protokoll SomeProtocol {} func test1_1(väärtus: SomeProtocol) {} func test1_2(väärtus: any SomeProtocol) {}
protokoll SomeProtocol {} func test1_1(ülesanne: SomeProtocol) {} func test1_2(ükski: SomeProtocol) {} func test2_1(ülesanne: some SomeProtocol) {} func test2_2<Ülesanne: SomeProtocol>(ülesanne: Ülesanne) {} klass A { func test2_2<Ülesanne: SomeProtocol>(ülesanne: Ülesanne) { } } klass B: SomeProtocol { } A().test2_2(ülesanne: B())
Kuidas oli fotogalerii liikumise ja suumimisega seotud interaktsioon — UIKit või SwiftUI?
Navigatsioon on kirjutatud UIKitis, ja teavitused/lehed on välja toodud UIKitis või kasutate SwiftUI loomulikke vahendeid?
luba, et vanem oleks Task { let child = Task { print("laps alustas, isCancelled = ", Task.isCancelled) // for index in (1...[phone]) { print(index) } print("laps lõpetas, isCancelled = ", Task.isCancelled) // } await child.value } try? await Task.sleep(nanoseconds: 1_000_000_000) // 1 sekund parent.cancel()
Räägi kasulikest Property Wrapper'itest, mida sa projektis kasutasid
Kas projektis sisaldab veel makro-sid, välja arvatud võrgu kiht?
Kui kasulikud on tehisintellekti tööriistad (Cursor, Proxyman jms), et aidata sul olla tööülesannetes produktiivsem?
struct CustomButtonStyleView: View { var body: some View { VStack { Button("Button") { print("Tapped") } } .buttonStyle(CustomButtonStyle()) } } private struct CustomButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label .padding() .foregroundColor(.white) .frame(maxWidth: .infinity) .background(Color.red) .clipShape(RoundedRectangle(cornerRadius: 8)) } }
struct ExampleView: View { var body: some View { VStack { FormView() Button("Reset") { // TODO: } } } } // AINULT LOE 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) } } }
Kas viimase WWDC ajal oli huvitavaid sessioone/rakendusi, mida soovite oma töös proovida?
Milline Swift keele versioon on projektis kasutusel — üle 6 või alla?
```swift struct CustomButtonStyleView: View { var body: some View { VStack { Button("Button") { print("Tapped") } .buttonStyle(CustomButtonStyle()) } } } private struct CustomButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label .padding() .foregroundColor(.white) .background(Color.red) .clipShape(RoundedRectangle(cornerRadius: 8)) } } ``` ```swift struct CustomButtonStyleView: View { var body: some View { VStack { Button("Button") { print("Tapped") } .buttonStyle(CustomButtonStyle()) } } } private struct CustomButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label .padding() .foregroundColor(.white) .frame(maxWidth?) .background(Color.red) .clipShape(RoundedRectangle(cornerRadius: 8)) } } ``` ```swift struct CustomButtonStyleView: View { var body: some View { VStack { Button("Button") { print("Tapped") } .buttonStyle(CustomButtonStyle()) } } } private struct CustomButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label //.padding() //.foregroundColor(.white) .frame(maxWidth: .infinity) .background(Color.red) //.clipShape(RoundedRectangle(cornerRadius: 8)) } } ``` ```swift struct CustomButtonStyleView: View { var body: some View { VStack { Button("Button") { print("Tapped") } .buttonStyle(CustomButtonStyle()) .frame(width: 200) } } } private struct CustomButtonStyle: ButtonStyle { func makeBody(configuration: Configuration) -> some View { configuration.label //.padding() //.foregroundColor(.white) .frame(maxWidth: .infinity) .background(Color.red) //.clipShape(RoundedRectangle(cornerRadius: 8)) } } ```
Raksta par interesantiem resursiem attīstībai — YouTube kanāli, Telegram kanāli, kopienas, rīki
Milline on praegu projekti minimaalne iOS siht?