Sobes.tech

დაცადეთ, რომ მშობელი იყოს Task { დაუშვით, რომ ბავშვი იყოს Task { print("child started, isCancelled = ", Task.isCancelled) // არა false for index in (1...[phone]) { print(index) } print("child finished, isCancelled = ", Task.isCancelled) // } await child.value } try? await Task.sleep(nanoseconds: 1_000_000_000) // 1 წამი parent.cancel() /////// დაცადეთ, რომ მშობელი იყოს Task { async let child: Void = { print("child started, isCancelled =", Task.isCancelled) for index in (1...[phone]) { print(index) } print("child finished, isCancelled =", Task.isCancelled) }() await child } try? await Task.sleep(nanoseconds: 1_000_000_000) // 1 წამი parent.cancel()

Senior
342

შეიძლება პირდაპირ მუშაობდით მოდულებში კონკურენციის პრობლემები (Sendable, unchecked Sendable, მსახიობებს შორის გადასვლები)?

Senior
251

SomeProtocol პროტოკოლი {} ფუნქცია test1_1 მნიშვნელობა: SomeProtocol {} ფუნქცია test2_1 მნიშვნელობა: some SomeProtocol {} ფუნქცია test1_2 მნიშვნელობა: any SomeProtocol {}

Senior
209

როგორ მუშაობს დიზაინის სისტემა UIKit და SwiftUI-ს შორის — არსებობს თუ არა კომპონენტების ან შემკვრების დუბლირება?

Senior
197

პროტოკოლი SomeProtocol {} func test1_1(ღირებულება: SomeProtocol) {} func test1_2(ღირებულება: any SomeProtocol) {}

Senior
190

პროტოკოლ SomeProtocol {} ფუნქცია test1_1(ღირებულება: SomeProtocol) {} ფუნქცია test1_2(ნებისმიერი SomeProtocol) {} ფუნქცია test2_1(ღირებულება: some SomeProtocol) {} ფუნქცია test2_2<ღირებულება: SomeProtocol>(ღირებულება: ღირებულება) {} კლასი A { ფუნქცია test2_2<ღირებულება: SomeProtocol>(ღირებულება: ღირებულება) { } } კლასი B: SomeProtocol { } A().test2_2(ღირებულება: B())

Senior
189

გთხოვთ, უფრო დეტალურად ისაუბროთ თქვენს ბოლო პროექტზე — ფოტოგალერეის მოდული ავიტოში, რომლის პასუხისმგებელიც იყავით (მოკლე ვადიანი გაქირავება, ბილეთის ფორმა და ა.შ.)

Senior
188

ნავიგაცია UIKit-ით არის დაწერილი, და ალერტები/შიტები UIKit-ში გამოდის თუ იყენებთ SwiftUI-ს ადგილობრივ საშუალებებს?

Senior
187

გააკეთეთ მშობელი Task { let child = Task { print("შვილი დაიწყო, isCancelled = ", Task.isCancelled) // for index in (1...[phone]) { print(index) } print("შვილი დასრულდა, isCancelled = ", Task.isCancelled) // } await child.value } try? await Task.sleep(nanoseconds: 1_000_000_000) // 1 წამი parent.cancel()

Senior
186

როგორ განხორციელდა შეხების მოძრაობებისა და ზუმის ინტერფეისი ფოტოგალერეაში — UIKit თუ SwiftUI?

Senior
184

პროექტში გამოყენებული სასარგებლო Property Wrapper-ების შესახებ ისაუბრე

Senior
183

პროექტში სხვა მაკროები არსებობს თუ არა ქსელის ფენას გარდა?

Senior
179

struct ExampleView: View { var body: some View { VStack { FormView() Button("Reset") { // TODO: } } } } // სამოგზაურო მხოლოდ კითხვა struct FormView: View { @State private var firstname = "" @State private var lastname = "" @State private var email = "" @State private var website = "" var body: some View { Form { TextField("Enter firstname", text: self.$firstname) TextField("Enter lastname", text: self.$lastname) TextField("Enter email address", text: self.$email) TextField("Enter website address", text: self.$website) } } }

Senior
176

რამდენად გეხმარებათ ხელოვნური ინტელექტის ინსტრუმენტები (Cursor, Proxyman და სხვა) სამუშაოს პროდუქტიულობის გაზრდაში?

Senior
175

რა ვერსიაა Swift ენის — ზევით 6 ან ქვემოთ?

Senior
173

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
172

რა არის მიმდინარე მინიმალური iOS მიზანი პროექტში?

Senior
171

Array { value1 value2 if condition { value3 } }

Senior
171

როდესაც პროექტზე მოხვდი, უკვე იყო Swift 6, თუ ტრანსიცია შენთან მოხდა?

Senior
170

```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)) } } ``` Вызывается задача о настройке стиля кнопки SwiftUI, экспериментировании с различными модификаторами, такими как отступы, цвет переднего плана, ширина рамки, цвет фона и форма обрезки. Вероятно, вопрос включает исправление или улучшение стиля кнопки для достижения желаемого внешнего вида или поведения, например, чтобы кнопка заполняла доступную ширину или настраивала ее визуальный стиль.

Senior
169
/2