iOS
protocolas SomeProtocol {} func test1_1(reikšmė: SomeProtocol) {} func test2_1(reikšmė: some SomeProtocol) {} func test1_2(reikšmė: any SomeProtocol) {}
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)) } }
Kaip veikia dizaino sistema tarp UIKit ir SwiftUI — ar yra komponentų ar apvijų dubliavimosi?
```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)) } } ```
Kas nutinka, kai į set perduodamas nil?
Ar šiuo metu naudojate GCD ar Modern Concurrency (async/await) naujiems užduotims, susijusioms su siūlais?
Kai atvykai į projektą, ar jau buvo Swift 6, ar pereinamasis laikotarpis įvyko tavo buvimo metu?
```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 } } } ```
Ar buvo problemų su konkurencingumu (Sendable, unchecked Sendable, perėjimai tarp veikėjų) moduliuose, su kuriais tiesiogiai dirbote?
@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) }
Ar projekte yra daugiau makrokomandų, išskyrus tinklo sluoksnį?
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())
Trumpai pristatykite save ir aprašykite savo dabartinį darbą.
Kas naudojama prezentacijos moduliams UIKit ir SwiftUI — kokia architektūra?
Kada ir kaip vyksta atšaukimas naudojant DispatchQueue su WorkItem ir iškvietus cancel()?
Ar paskutinėje WWDC buvo įdomių sesijų/arba karkasų, kuriuos norėtumėte išbandyti savo darbe?
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()
Jei įgyvendinate naują ekraną ar naują funkciją, ar rašote iš karto SwiftUI, ar yra diskusijų dėl pasirinkimo tarp UIKit ir SwiftUI?
Papaskink apie naudingus Property Wrapper'us, kuriuos naudojai projekte
Papasakok daugiau apie savo paskutinį projektą — nuotraukų galerijos modulį Avito, už kurį atsakei (trumpalaikė nuoma, rezervacijos forma ir kt.)