deixe que parent seja Task { deixe que child seja Task { print("child started, isCancelled = ", Task.isCancelled) // NÃO 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 segundo parent.cancel() /////// deixe que parent seja 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 segundo parent.cancel()
iOS
Houve problemas com concorrência (Sendable, Sendable não verificado, transição entre atores) nos módulos com os quais trabalhou diretamente?
protocolo SomeProtocol {} func test1_1(valor: SomeProtocol) {} func test2_1(valor: algum SomeProtocol) {} func test1_2(valor: qualquer SomeProtocol) {}
A navegação é escrita em UIKit, e os alertas/folhas são colocados no UIKit ou usa os meios nativos do SwiftUI?
Como funciona o sistema de design entre UIKit e SwiftUI — há duplicação de componentes ou envoltórios?
Houve sessões ou frameworks interessantes na última WWDC que gostaria de experimentar aplicar no seu trabalho?
protocolo SomeProtocol {} func test1_1(valor: SomeProtocol) {} func test1_2(valor: any SomeProtocol) {}
protocolo SomeProtocol {} funcao test1_1(valor: SomeProtocol) {} funcao test1_2(valor: qualquer SomeProtocol) {} funcao test2_1(valor: some SomeProtocol) {} funcao test2_2<Valor: SomeProtocol>(valor: Valor) {} classe A { funcao test2_2<Valor: SomeProtocol>(valor: Valor) { } } classe B: SomeProtocol { } A().test2_2(valor: B())
Fala-me mais sobre o teu último projeto — o módulo de galeria de fotos no Avito, pelo qual eras responsável (arrendamento de curto prazo, formulário de reserva, etc.)
Como é que o View e o ViewModel comunicam no UIKit — é utilizado algo como RxSwift/Combine para ligações?
Como foi implementada a interação com gestos e zoom na galeria de fotos — no UIKit ou SwiftUI?
deixe o pai ser Task { let child = Task { print("filho iniciado, isCancelled = ", Task.isCancelled) // for index in (1...[phone]) { print(index) } print("filho terminado, isCancelled = ", Task.isCancelled) // } await child.value } try? await Task.sleep(nanoseconds: 1_000_000_000) // 1 segundo parent.cancel()
Fala sobre os Property Wrapper úteis que usaste no projeto
struct ExampleView: View { var body: some View { VStack { FormView() Button("Reset") { // TODO: } } } } // SOMENTE LEITURA 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) } } }
Existem mais macros no projeto além da camada de rede?
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)) } }
Que utilidade têm as ferramentas de IA (Cursor, Proxyman, etc.) para te ajudar a ser mais produtivo no trabalho?
```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)) } } ``` O objetivo parece ser personalizar um estilo de botão em SwiftUI, experimentando com diferentes modificadores como padding, cor de primeiro plano, largura do quadro, cor de fundo e forma de recorte. A questão provavelmente envolve corrigir ou melhorar o estilo do botão para alcançar uma aparência ou comportamento desejado, como fazer o botão preencher toda a largura disponível ou ajustar seu estilo visual.
Qual é a versão do Swift usada no projeto — superior a 6 ou inferior?
Array { value1 value2 if condition { value3 } }