Sobes.tech

протокол SomeProtocol {} func test1_1(вредност: SomeProtocol) {} func test1_2(вредност: any SomeProtocol) {}

Senior
Salmon
36

protokol SomeProtocol {} func test1_1(vrednost: SomeProtocol) {} func test2_1(vrednost: some SomeProtocol) {} func test1_2(vrednost: any SomeProtocol) {}

Senior
Salmon
35

Šta se dešava kada se nil prosledi u set?

Middle+
RevolutRevolut
35

Kako funkcioniše sistem dizajna između UIKit i SwiftUI — postoji li duplikacija komponenti ili omotača?

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

Senior
Salmon
35

Да ли тренутно користите GCD или Modern Concurrency (async/await) за нове задатке везане за нитове?

Senior
Salmon
32

Da li su postojali problemi sa konkurentnošću (Sendable, unchecked Sendable, prelaz između aktera) u modulima sa kojima ste direktno radili?

Senior
Salmon
32

Kada si došao na projekat, da li je već postojao Swift 6 ili je prelaz nastao tokom tvog prisustva?

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

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

Senior
Salmon
31

протокол 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())

Senior
Salmon
30

Da li u projektu postoje još makroi osim sloja mreže?

Senior
Salmon
30

Кратко се представите и опишите свој тренутни посао.

Middle+
RevolutRevolut
29

Šta se koristi za prezentacijske module u UIKit i SwiftUI — koja arhitektura?

Senior
Salmon
28

Kada i kako se dešava otkazivanje kada koristite DispatchQueue sa WorkItem i pozovete cancel()?

Senior
Salmon
28

Da li su na poslednoj WWDC bili interesantni sesije/okviri koje biste želeli da pokušate da primenite u svom radu?

Senior
Salmon
28

Ako biste projektovali komponentu dugmeta za sistem dizajna u SwiftUI sa različitim stilovima (primarni/sekundarni), kako biste to implementirali?

Senior
Salmon
27

протокол 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

Ako implementirate novi ekran ili novu funkciju, odmah pišete na SwiftUI, ili postoje diskusije o izboru između UIKit i SwiftUI?

Senior
Salmon
26

Ispričaj o korisnim Property Wrapper-ima koje si koristio u projektu

Senior
Salmon
26
/206