iOS
протокол SomeProtocol {} func test1_1(вредност: SomeProtocol) {} func test1_2(вредност: any SomeProtocol) {}
protokol SomeProtocol {} func test1_1(vrednost: SomeProtocol) {} func test2_1(vrednost: some SomeProtocol) {} func test1_2(vrednost: any SomeProtocol) {}
Šta se dešava kada se nil prosledi u set?
Kako funkcioniše sistem dizajna između UIKit i SwiftUI — postoji li duplikacija komponenti ili omotača?
```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)) } } ``` Výzva se zdá být o přizpůsobení stylu tlačítka SwiftUI, experimentování s různými modifikátory, jako je odsazení, barva popředí, šířka rámečku, barva pozadí a tvar oříznutí. Otázka pravděpodobně zahrnuje opravu nebo vylepšení stylu tlačítka tak, aby dosáhla požadovaného vzhledu nebo chování, například aby tlačítko vyplnilo dostupnou šířku nebo upravit jeho vizuální styl.
Да ли тренутно користите GCD или Modern Concurrency (async/await) за нове задатке везане за нитове?
Da li su postojali problemi sa konkurentnošću (Sendable, unchecked Sendable, prelaz između aktera) u modulima sa kojima ste direktno radili?
Kada si došao na projekat, da li je već postojao Swift 6 ili je prelaz nastao tokom tvog prisustva?
```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 } } } ```
@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("Neuspešno preuzimanje slike: \(error)") } } } Button("Preuzmi") { onDownloadPhoto(url) }
протокол SomeProtocol { func test() } func test1_1(вредност: SomeProtocol) {} func test1_2(вредност: any SomeProtocol) {} func test2_1(вредност: some SomeProtocol) {} func test2_2<Вредност: SomeProtocol>(вредност: Вредност) {} class A { func test2_2<Вредност: SomeProtocol>(вредност: Вредност) { } } class B: SomeProtocol { func test() {} } class C: B {} A().test2_2(вредност: B())
Da li u projektu postoje još makroi osim sloja mreže?
Кратко се представите и опишите свој тренутни посао.
Šta se koristi za prezentacijske module u UIKit i SwiftUI — koja arhitektura?
Kada i kako se dešava otkazivanje kada koristite DispatchQueue sa WorkItem i pozovete cancel()?
Da li su na poslednoj WWDC bili interesantni sesije/okviri koje biste želeli da pokušate da primenite u svom radu?
Ako biste projektovali komponentu dugmeta za sistem dizajna u SwiftUI sa različitim stilovima (primarni/sekundarni), kako biste to implementirali?
протокол 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()
Ako implementirate novi ekran ili novu funkciju, odmah pišete na SwiftUI, ili postoje diskusije o izboru između UIKit i SwiftUI?
Ispričaj o korisnim Property Wrapper-ima koje si koristio u projektu