нека родителят да бъде Task { нека детето да бъде Task { print("child started, isCancelled = ", Task.isCancelled) // НЕ 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 секунда parent.cancel() /////// нека родителят да бъде Task { 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 секунда parent.cancel()
iOS
Има ли проблеми с конкуренцията (Sendable, unchecked Sendable, преход между актьорите) в модулите, с които работихте директно?
протокол SomeProtocol {} func test1_1(стойност: SomeProtocol) {} func test2_1(стойност: some SomeProtocol) {} func test1_2(стойност: any SomeProtocol) {}
Как работи системата за дизайн между UIKit и SwiftUI — има ли дублиране на компоненти или обвивки?
Разкажи повече за последния си проект — модула за фотогалерия в Авито, за който отговаряше (краткосрочен наем, форма за резервация и т.н.)
протокол SomeProtocol {} func test1_1(стойност: SomeProtocol) {} func test1_2(стойност: any SomeProtocol) {}
Навигацията е написана на UIKit, а известията/шитове извеждате в UIKit или използвате нативните средства на SwiftUI?
протокол SomeProtocol {} функция test1_1(стойност: SomeProtocol) {} функция test1_2(стойност: всякакъв SomeProtocol) {} функция test2_1(стойност: some SomeProtocol) {} функция test2_2<Стойност: SomeProtocol>(стойност: Стойност) {} клас A { функция test2_2<Стойност: SomeProtocol>(стойност: Стойност) { } } клас B: SomeProtocol { } A().test2_2(стойност: B())
Как беше реализирано взаимодействието с жестове и увеличение във фотогалерията — на UIKit или SwiftUI?
нека родителят бъде Task { let child = Task { print("дете започна, isCancelled = ", Task.isCancelled) // for index in (1...[phone]) { print(index) } print("дете приключи, isCancelled = ", Task.isCancelled) // } await child.value } try? await Task.sleep(nanoseconds: 1_000_000_000) // 1 секунда parent.cancel()
Разкажи за полезните Property Wrapper, които си използвал в проекта
Има ли още макроси в проекта освен мрежовия слой?
Колко ти помагат инструментите за ИИ (Cursor, Proxyman и т.н.) да бъдеш по-продуктивен на работното място?
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: } } } } // ТЕСТИРАНЕ САМО ЗА ЧЕТЕНЕ 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) } } }
Array { value1 value2 if condition { value3 } }
Коя версия на езика Swift се използва в проекта — по-горе или по-ниско от 6?
Имаше ли интересни сесии/рамки на последната WWDC, които бихте искали да опитате да приложите в работата си?
```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)) } } ``` Výzva se zdá být o přizpůsobení stylu tlačítka SwiftUI, experimentování s různými modifikátory, jako je odsazení, barva popředí, šířka rámečku, barva pozadí a tvar oříznutí. Otázka pravděpodobně zahrnuje opravu nebo vylepšení stylu tlačítka tak, aby dosáhla požadovaného vzhledu nebo chování, například aby tlačítko vyplnilo dostupnou šířku nebo upravit jeho vizuální styl.
Разкажи за интересни ресурси за развитие — YouTube канали, Telegram канали, общности, инструменти