iOS
protocole SomeProtocol {} func test1_1(valeur: SomeProtocol) {} func test2_1(valeur: some SomeProtocol) {} func test1_2(valeur: any SomeProtocol) {}
Lorsque vous êtes arrivé sur le projet, Swift 6 était-il déjà en place, ou la transition s'est-elle produite pendant votre présence?
protocole SomeProtocol {} func test1_1(valeur: SomeProtocol) {} func test1_2(valeur: any SomeProtocol) {}
Utilisez-vous actuellement GCD ou Concurrence Moderne (async/await) pour de nouvelles tâches liées aux threads?
Comment View et ViewModel communiquent-ils dans UIKit ? Utilise-t-on quelque chose comme RxSwift/Combine pour les liaisons ?
```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 } } } ```
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()) } } } 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)) } } ``` L'objectif semble être de personnaliser un style de bouton SwiftUI, en expérimentant avec différents modificateurs tels que padding, couleur de premier plan, largeur du cadre, couleur de fond et forme de découpe. La question concerne probablement la correction ou l'amélioration du style du bouton pour obtenir une apparence ou un comportement souhaité, comme faire en sorte que le bouton remplisse toute la largeur disponible ou ajuster son style visuel.
classe finale 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) } }
protocole SomeProtocol { func test() } func test1_1(valeur: SomeProtocol) {} func test1_2(valeur: any SomeProtocol) {} func test2_1(valeur: some SomeProtocol) {} func test2_2<Val: SomeProtocol>(valeur: Val) {} class A { func test2_2<Val: SomeProtocol>(valeur: Val) { } } class B: SomeProtocol { func test() {} } class C: B {} A().test2_2(valeur: B())
Self -> Tâche -> (fort) Self .... Retour -> Voir desinit -> Voir le modèle deinit?
Quand et comment l'annulation se produit-elle lors de l'utilisation de DispatchQueue avec WorkItem et l'appel à cancel() ?
Si vous conceviez un composant de bouton réutilisable pour un système de design en SwiftUI avec différents styles (primaire/secundaire), comment le réaliseriez-vous?
Qu'est-ce qui est utilisé pour les modules de présentation dans UIKit et SwiftUI — quelle architecture?
Y a-t-il eu des problèmes de concurrence (Sendable, Sendable non vérifié, transition entre acteurs) dans les modules avec lesquels vous travailliez directement?
@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("Échec du téléchargement de l'image : \(error)") } } } Button("Télécharger") { onDownloadPhoto(url) }
Présentez-vous brièvement et décrivez votre travail actuel.
Parle-moi plus en détail de ton dernier projet — le module de galerie photo sur Avito, dont tu étais responsable (location à court terme, formulaire de réservation, etc.)
Y a-t-il eu des sessions ou des frameworks intéressants lors de la dernière WWDC que vous aimeriez essayer d'appliquer dans votre travail?
Y a-t-il d'autres macros dans le projet en plus de la couche réseau?