Category "swift"

UITextView contentSize is not update after paste swift iOS

When I paste some text, textview height of contentSize is not correct. It returns text height before paste. For example, I expect height value : [contentSize He

Injecting a single dependency to a view model

I want the LoginViewModel to have a single dependency of LoginViewModelService. 
LoginViewModelService in itself cannot have an implementation. Its method

Caret position in NSTextField of NSTableView

I have a view based NSTableView of n rows and 1 column, with a monospaced font. When the user clicks within a row, I need to convert the caret position to a cha

AVPlayerViewController audio continues playing in background after dismissal

My goal is to: Record a video Show it in a view and play it on a loop Dismiss it from the view Repeat with a new video Problem: Steps 1-3 work. However, the aud

Xcode program: Text box that the user can interact with through touch

I am new to Xcode and Swift. I want to create a text box for a video game that acts as the dialogue between the game and the user. for example I want the text b

iOS TextView is saved blurry when scaled

I tried save textview as image with not device scale. I implemented a method to save an image by adding an arbitrary textview according to the UI value. Because

Disable dark mode on iOS app while still being able to get prefers-color-scheme from WKWebView

I'm using the newest version on Xcode for my iOS app. I don't want iOS to automatically change the colors in my app when device is in dark mode, because it does

SwiftUI: Array Not Updating In All Views When Referencing The Same Observed Object

I am a fairly novice developer. I wrote an app for tracking indoor bouldering climbs all in 1 really large file. It was working fine, just hard to maintain. Now

How to get the List's offset when adding an element in SwiftUI

I want to get the list's offset to achieve pagination. So, I wrote like below. ContentView.swift import SwiftUI struct ContentView: View { @State var list =

Custom Decodable JSON - Get first array element

I have JSON data that looks like this: { // Other attributes here.... "id": "a4s5d6f8ddw", "images": { "selection": [ { "url": "https://

UICollectionViewCompositionalLayout: How to expand cells to same height?

I'm trying out the UICollectionViewCompositionalLayout as a way to build a UI where there are both a vertical and horizontal arrangement of cells. ie. one secti

How to change back button text in iPad in Swift UI?

Working on iPhone, iPad and Mac OS app, which has login screen. I took login View in NavigationView, when I tap on back button the login view will slide as spli

How can you verify a multiple code point emoji is supported?

For context, I'm trying to create a mapping from string code points to emojis and need to know if the system supports the emoji: ("1F9AE") -> "🦮" ("1

SWIFT Longitude and latitude from GoogleAutocomplete save in Firestore as nil

I am trying to save longitude and latitude to Firestore from GoogleAutocomlete but it saves as 0. I am able to save name and address successfully from the textf

Xcode 13.3.1 showing Build input files cannot be found error after changing my device

I recently changed my device from iPhone 8 to an iPhone 13 mini and tried to run my app on it but xcode is failing and showing me Build input files cannot be fo

What's difference between `add(_)` and `add(_) async`?

I don't understand what's the difference between add(_) and add(_) async method. Like the below code, the MyActor has two add methods and one of them uses async

SwiftUI navigationLink isActivie not working [closed]

Purpose My intention is to come back from view3 and return directly to view1 Current Status My view hierarchy here is view1 -> view2 ->

Is it possible to make the LazyVGrid header have the same appearance as a List header

Goal My goal is to make the LazyVGrid header look exactly the same as the List header. When utilizing the Grid view, the header is transparent and shows the con

Create common layout for Navigation Bar in SwiftUI So other SwiftUI views should reuse same Nav Bar

In iOS SwiftUI, How we can make a common layout for Navigation Bar. So we can use that in all project without re-write the same code. We can use ViewBuilder to

Return the data of a model directly instead of a dictionary Express.js and Mongoose

Probably the title isn't very clear and is a bit confusing, and to be honest, I do not really know how to ask this question since I'm new to JavaScript and Mong