deja que parent sea Task { deja que child sea Task { print("child started, isCancelled = ", Task.isCancelled) // NO 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() /////// deja que parent sea 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
¿Hubo problemas con la concurrencia (Sendable, Sendable no comprobado, transición entre actores) en los módulos con los que trabajaba directamente?
protocolo SomeProtocol {} función test1_1(valor: SomeProtocol) {} función test2_1(valor: some SomeProtocol) {} función test1_2(valor: any SomeProtocol) {}
¿Cómo funciona el sistema de diseño entre UIKit y SwiftUI: hay duplicación de componentes o envoltorios?
protocolo SomeProtocol {} función test1_1(valor: SomeProtocol) {} función test1_2(valor: any SomeProtocol) {}
protocolo SomeProtocol {} función test1_1(valor: SomeProtocol) {} función test1_2(valor: cualquier SomeProtocol) {} función test2_1(valor: some SomeProtocol) {} función test2_2<Valor: SomeProtocol>(valor: Valor) {} clase A { función test2_2<Valor: SomeProtocol>(valor: Valor) { } } clase B: SomeProtocol { } A().test2_2(valor: B())
dejar que el padre sea Task { let child = Task { print("hijo iniciado, isCancelled = ", Task.isCancelled) // for index in (1...[phone]) { print(index) } print("hijo terminado, isCancelled = ", Task.isCancelled) // } await child.value } try? await Task.sleep(nanoseconds: 1_000_000_000) // 1 segundo parent.cancel()
Cuéntame más sobre tu último proyecto: el módulo de galería de fotos en Avito, del cual eras responsable (alquiler a corto plazo, formulario de reserva, etc.)
¿La navegación está escrita en UIKit, y los alertas/hojas las sacas a UIKit o usas los medios nativos de SwiftUI?
¿Hay más macros en el proyecto además de la capa de red?
¿Cómo se implementó la interacción con gestos y zoom en la galería de fotos: en UIKit o SwiftUI?
struct ExampleView: View { var body: some View { VStack { FormView() Button("Reset") { // TODO: } } } } // SOLO LECTURA 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) } } }
Cuéntame sobre los Property Wrapper útiles que usaste en el proyecto
¿Qué tan útiles son las herramientas de IA (Cursor, Proxyman, etc.) para ayudarte a ser más productivo en el trabajo?
¿Qué versión del lenguaje Swift se utiliza en el proyecto: superior a 6 o inferior?
¿Cuál es el objetivo mínimo de iOS en el proyecto ahora?
Array { value1 value2 if condition { value3 } }
¿Cuando llegaste al proyecto, ya existía Swift 6, o la transición ocurrió durante tu tiempo?
clase final ProfileViewModel1 { enum Estado { ... } var estado: Estado = .idle let servicio: UserService init(servicio: UserService) { ... } func onBackPress() { // vista deinit } func loadUser() { estado = .loading Task { [weak self] guard let self else { return } do { let usuario = try await self.servicio.fetchUser() self.estado = .loaded(usuario) } catch { self.estado = .failed(error.localizedDescription) } } } }
¿Hay problemas, soluciones temporales u restricciones relacionadas con SwiftUI en el objetivo de iOS 16 en comparación con iOS 15?