Sobes.tech

protokoll SomeProtocol {} funktsioon test1_1 väärtus: SomeProtocol {} funktsioon test2_1 väärtus: some SomeProtocol {} funktsioon test1_2 väärtus: any SomeProtocol {}

Senior
Salmon
39

protokoll SomeProtocol {} func test1_1(väärtus: SomeProtocol) {} func test1_2(väärtus: any SomeProtocol) {}

Senior
Salmon
39

Kuidas suhtlevad View ja ViewModel UIKitus — kas sarnast RxSwift/Combine kasutamist sidumiste jaoks?

Senior
Salmon
38

```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
37

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
37

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

Senior
Salmon
37

Kas kasutate praegu GCD või Modern Concurrency (async/await) uusi ülesandeid, mis on seotud niitidega?

Senior
Salmon
36

Kui sa tulid projekti, kas Swift 6 juba olemas või toimus üleminek sinu ajal?

Senior
Salmon
35

Lõplik klass NetworkService, mis tegeleb võrgupäringutega, on kirjutatud Swift keeles ja kasutab asünkroonseid funktsioone koos generiliste parameetrite Response ja Bodyga, et sobitada vastavalt Decodable ja Encodable protokollidele. Kood kontrollib URL-i, seadistab päised, saadab päringu ja töötleb vastust, kontrollides staatuskoodi ning dekodeerides andmeid vastavalt Response tüübile.

Middle+
СБЕРСБЕР
34

protokoll SomeProtocol { func test() } func test1_1(ülesanne: SomeProtocol) {} func test1_2(ülesanne: any SomeProtocol) {} func test2_1(ülesanne: some SomeProtocol) {} func test2_2<Ülesanne: SomeProtocol>(ülesanne: Ülesanne) {} class A { func test2_2<Ülesanne: SomeProtocol>(ülesanne: Ülesanne) { } } class B: SomeProtocol { func test() {} } class C: B {} A().test2_2(ülesanne: B())

Senior
Salmon
34

Millal ja kuidas toimub tühistamine, kasutades DispatchQueue koos WorkItem ja kutsudes cancel()?

Senior
Salmon
33

Kas oli probleeme konkurentsivõimega (Sendable, unchecked Sendable, üleminek aktorite vahel) modulites, millega otseselt töötasite?

Senior
Salmon
32

@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("Neizdevās lejupielādēt attēlu: \(error)") } } } Button("Lejupielādēt") { onDownloadPhoto(url) }

Senior
Salmon
32

Self -> Ülesanne -> (tugev) Self .... Tagasi -> View desinit -> View model deinit?

Senior
Salmon
31

Mis kasutatakse UIKit ja SwiftUI esitlusmoodulite jaoks — milline arhitektuur?

Senior
Salmon
31

Lühidalt tutvustage end ja kirjeldage oma praegust tööd.

Middle+
RevolutRevolut
30

Kui te kujundaksite korduvkasutatava nupu komponendi SwiftUI disainisüsteemile erinevate stiilidega (esmane/sekundaarne), kuidas te seda rakendaksite?

Senior
Salmon
30

Kas projektis sisaldab veel makro-sid, välja arvatud võrgu kiht?

Senior
Salmon
30

Kui te rakendate uue ekraani või uue funktsiooni, kas kirjutate kohe SwiftUI-s või on arutelusid UIKit ja SwiftUI valiku üle?

Senior
Salmon
28

Räägi mulle oma viimase projekti kohta rohkem — Avito fotogalerii moodul, mille eest vastutasid (lühiajaline rent, broneerimisvorm jne.)

Senior
Salmon
28
/206