Can you explain how the MRC mechanism functions?
Why is it important to adhere to the single responsibility principle in programming?
Do you have experience using the Core Location framework in projects?
What methods do you use to detect memory leaks in your projects?
What is the difference between an interface and an abstract class in object-oriented programming?
Can you explain what the term 'Responder' means and what role it plays?
Could you tell about cases when disagreements or conflicts arose in your team and how you resolved them?
What limitations exist when using a standard queue in queue systems?
Why do some requests return a price that was never there (for example, an intermediate value between the old and new price)?
Are there issues, hacks, or limitations related to SwiftUI with iOS 16 target compared to iOS 15?
let parent = Task { let child = Task { print("child started, isCancelled = ", Task.isCancelled) // 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 second parent.cancel()
let parent = Task { let child = Task { print("child started, isCancelled = ", Task.isCancelled) // NO 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 second parent.cancel() /////// let parent = 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 second parent.cancel()
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)) } }
struct ExampleView: View { @State var isVariant1 = true var body: some View { VStack { Toggle("Use Variant 1", isOn: $isVariant1.animation(.linear)) Text(isVariant1 ? "Variant 1" : "Variant 2") } .padding() } } Variant1 -> scale -> 1 -> 0 Variant2 -> scale -> 0
```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)) } } ``` The task appears to be about customizing a SwiftUI button style, experimenting with different modifiers such as padding, foreground color, frame width, background color, and clipping shape. The question likely involves fixing or improving the button style to achieve a desired appearance or behavior, such as making the button fill the available width or adjusting its visual style.
protocol SomeProtocol { func test() } func test1_1(value: SomeProtocol) {} func test1_2(value: any SomeProtocol) {} func test2_1(value: some SomeProtocol) {} func test2_2<Value: SomeProtocol>(value: Value) {} class A { func test2_2<Value: SomeProtocol>(value: Value) { } } class B: SomeProtocol { func test() {} } class C: B {} A().test2_2(value: B())
Do you use Viper architecture for UIKit? Does this apply to all applications?
protocol SomeProtocol {} func test1_1(value: SomeProtocol) {} func test1_2(value: any SomeProtocol) {} func test2_1(value: some SomeProtocol) {} func test2_2<Value: SomeProtocol>(value: Value) {} class A { func test2_2<Value: SomeProtocol>(value: Value) { } } class B: SomeProtocol { } A().test2_2(value: B())
protocol SomeProtocol {} func test1_1(value: SomeProtocol) {} func test1_2(value: any SomeProtocol) {}
What does “fast” mean for a dictionary, and what is its lookup complexity? Is it always O(1)?