Sobes.tech

protocolas SomeProtocol {} func test1_1(reikšmė: SomeProtocol) {} func test2_1(reikšmė: some SomeProtocol) {} func test1_2(reikšmė: 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

Kaip veikia dizaino sistema tarp UIKit ir SwiftUI — ar yra komponentų ar apvijų dubliavimosi?

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?) .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)) } } ```

Senior
Salmon
35

Kas nutinka, kai į set perduodamas nil?

Middle+
RevolutRevolut
34

Ar šiuo metu naudojate GCD ar Modern Concurrency (async/await) naujiems užduotims, susijusioms su siūlais?

Senior
Salmon
32

Kai atvykai į projektą, ar jau buvo Swift 6, ar pereinamasis laikotarpis įvyko tavo buvimo metu?

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

Ar buvo problemų su konkurencingumu (Sendable, unchecked Sendable, perėjimai tarp veikėjų) moduliuose, su kuriais tiesiogiai dirbote?

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("Nepavyko atsisiųsti vaizdo: \(error)") } } } Button("Atsisiųsti") { onDownloadPhoto(url) }

Senior
Salmon
31

Ar projekte yra daugiau makrokomandų, išskyrus tinklo sluoksnį?

Senior
Salmon
30

protokolas SomeProtocol { func test() } func test1_1(reikšmė: SomeProtocol) {} func test1_2(reikšmė: any SomeProtocol) {} func test2_1(reikšmė: some SomeProtocol) {} func test2_2<Reikšmė: SomeProtocol>(reikšmė: Reikšmė) {} class A { func test2_2<Reikšmė: SomeProtocol>(reikšmė: Reikšmė) { } } class B: SomeProtocol { func test() {} } class C: B {} A().test2_2(reikšmė: B())

Senior
Salmon
29

Trumpai pristatykite save ir aprašykite savo dabartinį darbą.

Middle+
RevolutRevolut
28

Kas naudojama prezentacijos moduliams UIKit ir SwiftUI — kokia architektūra?

Senior
Salmon
28

Kada ir kaip vyksta atšaukimas naudojant DispatchQueue su WorkItem ir iškvietus cancel()?

Senior
Salmon
27

Ar paskutinėje WWDC buvo įdomių sesijų/arba karkasų, kuriuos norėtumėte išbandyti savo darbe?

Senior
Salmon
27

protokolas CacheProtocol { associatedtype 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

Jei įgyvendinate naują ekraną ar naują funkciją, ar rašote iš karto SwiftUI, ar yra diskusijų dėl pasirinkimo tarp UIKit ir SwiftUI?

Senior
Salmon
26

Papaskink apie naudingus Property Wrapper'us, kuriuos naudojai projekte

Senior
Salmon
26

Papasakok daugiau apie savo paskutinį projektą — nuotraukų galerijos modulį Avito, už kurį atsakei (trumpalaikė nuoma, rezervacijos forma ir kt.)

Senior
Salmon
26
/206