Sobes.tech

Ποιο είναι το ελάχιστο στόχο iOS στο έργο τώρα;

Senior
Salmon
45

Ποια έκδοση της γλώσσας Swift χρησιμοποιείται στο έργο — πάνω από 6 ή κάτω;

Senior
Salmon
45

πρωτόκολλο SomeProtocol {} func test1_1(τιμή: SomeProtocol) {} func test1_2(τιμή: any SomeProtocol) {}

Senior
Salmon
45

Χρησιμοποιείτε την αρχιτεκτονική Viper για το UIKit; Ισχύει για όλες τις εφαρμογές;

Senior
Salmon
44

πρωτόκολλο SomeProtocol {} func test1_1(τιμή: SomeProtocol) {} func test2_1(τιμή: some SomeProtocol) {} func test1_2(τιμή: any SomeProtocol) {}

Senior
Salmon
43

struct ExampleView: View { @State var isVariant1 = true var body: some View { VStack { Toggle("Χρησιμοποιήστε την Παραλλαγή 1", isOn: $isVariant1.animation(.linear)) Text(isVariant1 ? "Παραλλαγή 1" : "Παραλλαγή 2") } .padding() } } Παραλλαγή1 -> κλίμακα -> 1 -> 0 Παραλλαγή2 -> κλίμακα -> 0

Senior
Salmon
43

τελική κλάση NetworkService { func request<Response: Decodable, Body: Encodable>(urlString: String, method: HTTPMethod, body: Body? = nil, headers: [String: String] = [:], query: [String: String] = [:]) async throws -> Response { guard var components = URLComponents(string: urlString) else { throw Errors.invalidUrl } if !query.isEmpty { components.queryItems = query.map { URLQueryItem(name: $0.key, value: $0.value) } } guard let url = components.url else { throw Errors.invalidQuery } var request = URLRequest(url: url) request.httpMethod = method.rawValue headers.forEach { request.setValue($0.value, forHTTPHeaderField: $0.key) } if let body, method == .post { request.httpBody = try encoder.encode(body) // ? } let (data, response) = try await session.data(for: request) guard let httpResponse = response as? HTTPURLResponse else { throw Errors.invalidResponse } guard (200...299).contains(httpResponse.statusCode) else { throw Errors.httpStatus(httpResponse.statusCode) } return try decoder.decode(Response.self, from: data) } }

Middle+
СБЕРСБЕР
42

Χρησιμοποιείτε αυτήν τη στιγμή GCD ή Modern Concurrency (async/await) για νέες εργασίες που σχετίζονται με νήματα;

Senior
Salmon
40

Self -> Task -> (strong) Self .... Πίσω -> View desinit -> View model deinit?

Senior
Salmon
40

@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("Αποτυχία λήψης εικόνας: \(error)") } } } Button("Λήψη") { onDownloadPhoto(url) }

Senior
Salmon
40

Σε ποιο βαθμό σε βοηθούν τα εργαλεία ΤΝ (Cursor, Proxyman κ.ά.) να είσαι πιο παραγωγικός στη δουλειά;

Senior
Salmon
40

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

```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)) } } ```\n Φαίνεται ότι ο στόχος είναι να προσαρμόσετε ένα στυλ κουμπιού SwiftUI, πειραματιζόμενοι με διαφορετικούς τροποποιητές όπως padding, χρώμα μπροστινού, πλάτος πλαισίου, χρώμα φόντου και σχήμα περικοπής. Η ερώτηση πιθανώς αφορά τη διόρθωση ή βελτίωση του στυλ του κουμπιού για να επιτευχθεί μια επιθυμητή εμφάνιση ή συμπεριφορά, όπως το να γεμίζει το διαθέσιμο πλάτος ή η ρύθμιση του οπτικού στυλ του.

Senior
Salmon
39

Υπήρχαν προβλήματα με τον ανταγωνισμό (Sendable, unchecked Sendable, μετάβαση μεταξύ ηθοποιών) στα modules που εργάστηκες άμεσα;

Senior
Salmon
38

Γιατί επιλέξατε ένα λεξικό ως αποθήκευση cache;

Middle+
RevolutRevolut
38

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

Τι χρησιμοποιείται για τα παρουσιάσιμα modules στο UIKit και SwiftUI — ποια αρχιτεκτονική;

Senior
Salmon
36

Πες μου περισσότερα για το τελευταίο σου έργο — το module της φωτογραφικής γκαλερί στο Avito, για το οποίο ήσουν υπεύθυνος (βραχυπρόθεσμη ενοικίαση, φόρμα κράτησης κ.λπ.)

Senior
Salmon
36

πρωτόκολλο 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
35

Πότε και πώς πραγματοποιείται η ακύρωση όταν χρησιμοποιείται το DispatchQueue με WorkItem και καλείται η cancel();

Senior
Salmon
35
/206