lai vecāks būtu uzdevums { ļauj, lai bērns būtu uzdevums { print("child started, isCancelled = ", Task.isCancelled) // NĒ 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 sekunde parent.cancel() /////// lai vecāks būtu uzdevums { 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 sekunde parent.cancel()
iOS
Vai bija problēmas ar konkurētspēju (Sendable, unchecked Sendable, pārejas starp aktieriem) moduļos, ar kuriem tieši strādājāt?
protokols SomeProtocol {} funkcija test1_1 vērtība: SomeProtocol {} funkcija test2_1 vērtība: some SomeProtocol {} funkcija test1_2 vērtība: any SomeProtocol {}
Kā darbojas dizaina sistēma starp UIKit un SwiftUI — vai ir komponentu vai ietvaru dublēšanās?
Pastāsti vairāk par savu pēdējo projektu — foto galerijas moduli Avito, par kuru tu atbildēji (īslaicīga īre, rezervācijas veidlapa utt.)
Kā tika īstenota žestu un tālummaiņas mijiedarbība foto galerijā — UIKit vai SwiftUI?
protokols SomeProtocol {} func test1_1(vērtība: SomeProtocol) {} func test1_2(vērtība: any SomeProtocol) {}
protokols SomeProtocol {} func test1_1(atskaits: SomeProtocol) {} func test1_2( jebkā: SomeProtocol) {} func test2_1(atskaits: some SomeProtocol) {} func test2_2<Atskaits: SomeProtocol>(atskaits: Atskaits) {} klase A { func test2_2<Atskaits: SomeProtocol>(atskaits: Atskaits) { } } klase B: SomeProtocol { } A().test2_2(atskaits: B())
Navigācija ir uzrakstīta UIKit, un brīdinājumi/lapas tiek izvilktas uz UIKit vai izmantojat SwiftUI dabiskos līdzekļus?
atļaujiet vecākam būt Task { let child = Task { print("bērns sāka, isCancelled = ", Task.isCancelled) // for index in (1...[phone]) { print(index) } print("bērns beidzās, isCancelled = ", Task.isCancelled) // } await child.value } try? await Task.sleep(nanoseconds: 1_000_000_000) // 1 sekunde parent.cancel()
Pastāsti par noderīgiem Property Wrapper'iem, kurus izmantoji projektā
struct ExampleView: View { var body: some View { VStack { FormView() Button("Reset") { // TODO: } } } } // TIKAI LASIŲ 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) } } }
Vai projektā ir vēl makrokomandas, izņemot tīkla slāni?
Cik noderīgi ir mākslīgā intelekta rīki (Cursor, Proxyman utt.), lai palīdzētu tev būt produktīvākam darbā?
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)) } }
Kura Swift valodas versija tiek projektā — virs 6 vai zemāka?
Array { value1 value2 if condition { value3 } }
Vai pēdējā WWDC bija interesantas sesijas/rāmji, kuras vēlētos izmēģināt savā darbā?
```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?) .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)) } } ```
Kāds ir pašreizējais minimālais iOS mērķis projektā?