Questions tagged [viewmodifier]

59 questions
0
votes
1 answer

How to clear all text in a UIViewRepresentable Text Field with a view modifier

I'm trying to delete all text inside a Text Field when a button to the right of the text field is tapped. When I tap the clear button it behaves as though the text has been cleared. It shows the placeholder text which is set to be shown when the…
Tirna
  • 383
  • 1
  • 12
0
votes
0 answers

SwiftUI .sheet realisation

I'm trying to understand Apple .sheet view modifier realisation. I have realisation for custom bottom sheet: public struct ICBottomSheetView: View where ContentView: View { @Binding public var isShowing: Bool public var content:…
Sergey Udalov
  • 75
  • 1
  • 7
0
votes
0 answers

Using TimelineView to use in a custom view modifier

I am looking to use the Timelineview to automatically update the background colour for a popup sheet that is displaying a list. I am trying to figure out how to only call it once so I can use it for multiple sections in one list and in different…
0
votes
0 answers

SWIFTUI refreshable viewModifier

For SWIFTUI i have created a ViewModifier to use the refreshable(action) view modifier available under iOS15. with this modifier I don't have to embed my all view in availability check. It's seems to work properly, but I'm not confortable with the…
swordse
  • 1
  • 2
0
votes
1 answer

SwiftUI: @EnvironmentObject with ViewModifier?

Here is the idea of what I would like to do: my app's navigation contains a list, which displays a view on tap gesture which is triggered with a ViewModifier to perform an animation. In a nutshell: MyList > MyViewModifier > MyView Since I want to…
John DoeDoe
  • 133
  • 1
  • 7
0
votes
0 answers

How to blur a portion of a view in SwiftUI

I'd like to blur a portion of a camera view in SwiftUI. Like a blurred frame. My idea was to create a modifier for the camera view like the one in the code below. However when I apply the modifier the blurred content content.blur(radius: 7) is being…
kaharoth
  • 160
  • 1
  • 9
0
votes
1 answer

how do I make a swiftui viewmodifier that accepts any object?

I have a quite few reusable viewmodifiers in my projects, but I have never been able to make one that accepts any object instead of a specific object. Fx. in below viewmodifier, how would I make it accept any object instead of just "StopContent" so…
lmunck
  • 505
  • 4
  • 12
0
votes
0 answers

Inject ViewModifier to SwiftUI View

Current Situtation I work on an iOS SDK containing several UIViewControllers that can be customized through a delegate function passing a String as the identifier and getting a customized CALayer. With that, the host application can customize how…
Hassan Shahbazi
  • 1,543
  • 9
  • 26
0
votes
1 answer

Swiftui Scrollview Viewmodifier Applies to All Scrollviews

I have implemented a viewmodifier to Swiftui's scrollview in order to disable the built-in scrolling, to allow a custom drag gesture to apply. The modifier works great. The thing is the viewmodifier is being applied to other scrollviews in the app,…
jamabz
  • 1
  • 1
0
votes
1 answer

SwiftUI: Own ViewModifier doesn't refresh view

In my project I have two color pickers that change the background color and the font color. Sheet, where I change the Color: @ObservedObject var listColor: ListColor ColorPicker("Hintergrund", selection: $listColor.bgColor) …
Lukas
  • 251
  • 2
  • 13
0
votes
1 answer

How to implement view modifiers for text fields in a section at once?

I assume there must be a way you to use modifiers for every text field in a section without having to type them for each text field. Can the result of the example below be achieved with ForEach or something else that I'm not aware of? …
user12919782
0
votes
1 answer

How to workaround Swift generic type casting

I have code like this import SwiftUI struct TabItemModifier: ViewModifier where TabItem: View { var tabItem: () -> TabItem func body(content: Content) -> some View { return TabItemView(tabItem: tabItem, content:…
Michał Ziobro
  • 10,759
  • 11
  • 88
  • 143
-1
votes
1 answer

Some usages of custom generic view modifiers in SwiftUI do not compile

I am trying to replace a standard sheet modifier with a custom one that applies the same changes to the content of all sheets as to the main view (it can be useful for changing accent color, although there is a UIKit approach for it, but…
esp
  • 7,314
  • 6
  • 49
  • 79
-1
votes
1 answer

How to animate a Core Image Filter in SwiftUI

I want to apply a given CIFilter but instead of the effect showing up instantly, I want to animate it. For example, I want to desaturate a color image to grey scale over 2 seconds, or resolve a blocky image by depixellating it to a full-resolution…
God of Biscuits
  • 1,312
  • 1
  • 13
  • 27
1 2 3
4