Questions tagged swiftui

Explore the latest questions and answers asked by our top developers.

Fix line spacing in custom font in SwiftUI

I am using custom font (Catamaran) and it seems like it has big space between lines in it. For example I have this code: Text("Example text that has big space between lines") .lineSpacing(0) .padding(.horizontal) .font(Font.custom(FontNameManager.Catamaran.bold, size: 24.0)) .foregroundColor(.white) .multilineTextAlignment(.center) and it looks like this: As you can see it doesn’t have zero space between lines […]

By Libor Zapletal
Categorised as fonts, ios, line-spacing, swiftui, text Tagged , , , ,

How can I remove already rendered unneeded Views instead of rendering needed Views?

I am working on a CustomForEach which would act and work like a normal ForEach in SwiftUI, this CustomForEach has it own early days and it has some issues for use for me, which makes me to learn more about SwiftUI and challenge me to try to solve the issues, one of this issues is […]

By User
Categorised as swift, swiftui Tagged ,

BranchIO Universal Link iOS data only works when long pressing and selecting open with

I have implemented BranchI to handle universal links, I have been through the documentation and as far as I can everything should work. The behaviour I get is that when I long press and select open with ‘myApp’ from the menu all is fine and works as expected. However if I simply click the link, […]

By mhw
Categorised as ios, ios-universal-links, swift, swiftui Tagged , , ,

Deleting CoreData Item which is also an @ObservedObject in DetailView causing App Crash in Swift 5

I am currently working with SwiftUI and CoreData. Situation: I have a User Detail View with a Delete Button. When pressed, the Core Data Entry of the User is getting deleted and the App Navigation goes back to the Root Navigation View, which is a List of all Users. Problem: Every Time the Delete Button […]

By christophriepe
Categorised as core-data, ios, observedobject, swift, swiftui Tagged , , , ,

Make microphone ignore audio from AVSpeechSynthesizer

Inspired by this question (which didn’t receive an answer). Context: I have a (swiftUI) view that has 2 buttons and a textfield. One button turns on the mic and uses SFSpeechrecognizer to turn speech into text (and fills the textfield). This is then sent to my server and my app receives a response, which is […]

By nodel
Categorised as ios, sfspeechrecognizer, swift, swiftui Tagged , , ,

SwiftUI – iOS 13 UIViewRepresentable of WKWebView gets Thread 1: EXC_BREAKPOINT crash

I’m trying to port WKWebView over to SwiftUI, but I get Thread 1: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0) With nothing printed in the console. But, on iOS 14.2, it works fine. Here’s my code: import SwiftUI import WebKit struct ContentView: View { var body: some View { WebViewWrapper() } } /** WKWebView ported over to SwiftUI with […]

By aheze
Categorised as ios, swift, swiftui, uiviewrepresentable, wkwebview Tagged , , , ,

Trying to get full width of view using geometry reader and navigation bar – SwiftUI

I have 2 HStack‘s using geometry reader to split them evenly into 2 sections that are embedded into a VStack, I am trying to create a layout similar to the first below image (landscape mode on iPad). However, I am struggling to get the HStack‘s to line up like a grid meeting in the middle. […]

By spoax
Categorised as ios, ipad, swiftui, xcode Tagged , , ,

Multiple ui elements break WidgetExtension

I’m trying to dynamically build a view using SwiftUI for my widget. However, when multiple views are stacked, the widget no longer works. I want to loop my Widget over an array of fetched data, like so: VStack { ForEach(entry.layers.indices) { index in let layer = entry.layers[index] Text(layer) } } but this doesnt work properly […]

By Kipnoedels
Categorised as swift, swiftui, widgetkit Tagged , ,

SwiftUI – Prevent Sections from flying/zooming to the right in List when dynamically filtering them

I originally asked this question: SwiftUI – Dynamic List filtering animation flies to right side when data source is empty There, I had a List without sections. I was filtering them so that it only showed the rows that contained the text inside a TextField. The solution was to wrap everything inside the List in […]

By aheze
Categorised as ios, swift, swiftui, swiftui-list Tagged , , ,

How to manage AVPlayer state in SwiftUI

I have a list of URLs in SwiftUI. When I tap an item, I present a full screen video player. I have an @EnvironmentObject that handles some viewer options (for example, whether to show a timecode). I also have a toggle that shows and hides the timecode (I’ve only included the toggle in this example […]

Categorised as avfoundation, avkit, ios, swiftui Tagged , , ,
1 2 3 13

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us