Sobes.tech

protocolo SomeProtocol {} función test1_1(valor: SomeProtocol) {} función test2_1(valor: some SomeProtocol) {} función test1_2(valor: any SomeProtocol) {}

Senior
Salmon
35

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)) } }

Senior
Salmon
35

¿Cómo funciona el sistema de diseño entre UIKit y SwiftUI: hay duplicación de componentes o envoltorios?

Senior
Salmon
35

```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)) } } ``` El objetivo parece ser personalizar un estilo de botón en SwiftUI, experimentando con diferentes modificadores como padding, color de primer plano, ancho del marco, color de fondo y forma de recorte. La pregunta probablemente involucra arreglar o mejorar el estilo del botón para lograr una apariencia o comportamiento deseado, como hacer que el botón ocupe todo el ancho disponible o ajustar su estilo visual.

Senior
Salmon
35

¿Qué sucede cuando se pasa nil a set?

Middle+
RevolutRevolut
34

¿Actualmente utiliza GCD o Concurrencia Moderna (async/await) para nuevas tareas relacionadas con hilos?

Senior
Salmon
32

¿Cuando llegaste al proyecto, ya existía Swift 6, o la transición ocurrió durante tu tiempo?

Senior
Salmon
31

```swift struct ContentView: View { var body: some View { ScrollView { content .padding(20) } .background(Color(.systemGroupedBackground)) .overlay(alignment: .bottom) { continueButton } } } ``` ```swift struct ContentView: View { var body: some View { ScrollView { content .padding(20) } .background(Color(.systemGroupedBackground)) .safeAreaInset(edge: .bottom) { continueButton } } } ```

Senior
Salmon
31

¿Hubo problemas con la concurrencia (Sendable, Sendable no comprobado, transición entre actores) en los módulos con los que trabajaba directamente?

Senior
Salmon
31

@MainActor final class ViewModel: ObservableObject { @Published var image: UIImage? func onDownloadPhoto(url: URL) { do { let data = try Data(contentsOf: url) image = UIImage.init(data: data) } catch { log.error("Error al descargar la imagen: \(error)") } } } Button("Descargar") { onDownloadPhoto(url) }

Senior
Salmon
31

¿Hay más macros en el proyecto además de la capa de red?

Senior
Salmon
30

protocolo SomeProtocol { func test() } func test1_1(valor: SomeProtocol) {} func test1_2(valor: any SomeProtocol) {} func test2_1(valor: some SomeProtocol) {} func test2_2<Valor: SomeProtocol>(valor: Valor) {} class A { func test2_2<Valor: SomeProtocol>(valor: Valor) { } } class B: SomeProtocol { func test() {} } class C: B {} A().test2_2(valor: B())

Senior
Salmon
29

Preséntate brevemente y describe tu trabajo actual.

Middle+
RevolutRevolut
28

¿Qué se utiliza para los módulos de presentación en UIKit y SwiftUI — qué arquitectura?

Senior
Salmon
28

¿Cuándo y cómo se realiza la cancelación al usar DispatchQueue con WorkItem y llamar a cancel()?

Senior
Salmon
27

¿Hubo sesiones o marcos interesantes en la última WWDC que te gustaría probar en tu trabajo?

Senior
Salmon
27

protocolo CacheProtocol { tipo asociado Value func setValue(_ value: Value?, forKey key: String) func getValue(forKey key: String) -> Value? func fetchValue(forKey key: String, completion: @escaping (Value?) -> Void) } final class Cache<T>: CacheProtocol { private var storage: [String: T] = [:] func setValue(_ value: T?, forKey key: String) { storage[key] = value } func getValue(forKey key: String) -> T? { return storage[key] } func fetchValue(forKey key: String, completion: @escaping (T?) -> Void) { let value = storage[key] completion(value) } } import XCTest final class CacheTests: XCTestCase { override func setUp() { super.setUp() } func testSetAndGetValue() { let cache = Cache<String>() let key: String = "key" let value: String = "value" cache.setValue(value, forKey: key) XCTAssertEqual(cache.getValue(forKey: key), value) cache.setValue(nil, forKey: key) XCTAssertTrue(cache.getValue(forKey: key) == nil) } } CacheTests.defaultTestSuite.run()

Middle+
RevolutRevolut
26

Si estuvieras diseñando un componente de botón reutilizable para un sistema de diseño en SwiftUI con diferentes estilos (primario/secundario), ¿cómo lo implementarías?

Senior
Salmon
26

¿Si implementas una nueva pantalla o una nueva función, escribes inmediatamente en SwiftUI, o hay discusiones sobre la elección entre UIKit y SwiftUI?

Senior
Salmon
26

Cuéntame sobre los Property Wrapper útiles que usaste en el proyecto

Senior
Salmon
26
/206