Questions tagged [swift]

Swift is a general-purpose programming language developed by Apple Inc first released in 2014. for its platforms and Linux. Swift is open-source. Use the tag only for questions about language features, or requiring code in Swift. Use the tags [ios], [ipados], [macos], [watch-os], [tvos], [swiftui], [cocoa-touch], and [cocoa] for (language-agnostic) questions about the platforms or frameworks.

Filter by
Sorted by
Tagged with
0
votes
0answers
3 views

iOS 15 Notification Pemission Alert Not Showing

Need this type of alert prompt for notification. iOS 15, Xcode 13 (beta)
0
votes
1answer
11 views

Result of call to 'sorted(by:)' is unused

I am trying to sorted my array with higher to lower vote, I am able to append value in array, But when I tried to sorted it, It showing warning of Result of call to 'sorted(by:)' is unused My code is -...
0
votes
0answers
10 views

How to keep revolving a UIView around circle even when circle is changing its radius using CABasicAnimation?

I have an animation to make, where I am supposed to move a uiview around a circle. This much thing I have achieved, but I also need to make the UIView keep revolving around the Circle when the radius ...
0
votes
1answer
8 views

Unable to Archive ReactNative project in Mac M1

When I try to Archive, I get the following error - Multiple commands produce '/Users/kumar/Library/Developer/Xcode/DerivedData/project-giaimtwxkjihslcrnslgrczdvfrm/Build/Intermediates.noindex/...
0
votes
0answers
11 views

Swiftui - unable to access environment object

Im working on a project were I make a network call to a server and get different data back depending on the type of call I make. The issue I am facing is access the variables from my data that is ...
0
votes
0answers
10 views

How can I use the parent id to put the children's data?

func putpers (_ req: Request) throws -> EventLoopFuture<HTTPStatus> { let information = try req.content.decode(Pers.self) return Pers.find(information.$user.id, on: req.db) ...
-1
votes
0answers
24 views

How to provide force update after splitting the existing app in iOS [closed]

I had split the existing app into two targets. How to handle force update scenario here ?
0
votes
0answers
14 views

Can I upload private app on app store with G-Suite?

i need to post a private app on ios app store but as per Apple Bussiness Manager i need to have a azure account but my company has GSuite Account. what can be done on this issue ?
0
votes
0answers
11 views

Swiftui photoOutput for Images not called every time

This is actually the same issue as this post AVCapturePhotoCaptureDelegate photoOutput() not called every time however no one responded to that . I find that on takePic the photoOutput function is ...
0
votes
0answers
11 views

Stop user use control-c to stop command line tool in swift

I wanna stop user use control-c to stop command line tool, and do something when user press control + c. I find sth but it isn't work in the swift5 signal(SIGINT, SIG_IGN) let ...
0
votes
0answers
13 views

How to write a completion handler in a separated block of code in Swift with parameters out of scope

I was trying to make my code clean and decouple the code below, I want to remove the trailing completion handler from it and write the completion handler in another blck of code. func ...
-2
votes
2answers
33 views

Async/Await function without a return | Swift 5.5

How can I remove the Bool return from my function without getting the error: Generic parameter 'T' could not be inferred This is the function: private func syncDataStore() async throws -> Bool { ...
0
votes
0answers
11 views

CryptoSwift failing partial decryption

I am currently implementing partial decryption using AES-128 CBC mode. I have used 3 different libraries and 2 different native approaches to decrypt. So far, all of these fail at this one block that ...
0
votes
1answer
22 views

How to parse particular JSON file in SwiftUI

Let's say I'm trying to parse this particular JSON file with SwiftUI: data.json [ { "number": 1, "word": "hello", "sentence": { ...
0
votes
0answers
13 views

Why SF Symbol does not have bluetooth image?

While working on a swift project to make iPhone setting view using static cell. I am using apple provided SF symbols but I struggled to find the Bluetooth symbol.[Setting view i designedtable view ...
1
vote
1answer
19 views

Firebase post request Swift/SwiftUI Deprecated

I'm trying to send messages using firebase cloud messaging and followed some tutorials online. Although the code works, I'm running into deprecated warnings and I'd like to fix them if possible. Here ...
0
votes
1answer
31 views

Wrong date from components

So this is interesting: po Calendar.default.date(from: DateComponents(year: 2022, month: 1, hour: 16, minute: 1, second: 1, weekday: 1, weekOfMonth: 1)) ▿ Optional<Date> ▿ some : 2021-12-26 23:...
-1
votes
0answers
16 views

How to change UIAlertAction button with font style and background color [duplicate]

How to change font style & Font Color & BackgroundColor of the button for UIAlertAction let alertController = UIAlertController(title:"Alert", message: "Message", ...
-1
votes
0answers
42 views

Does Swift belong to the ML family? [closed]

Wikipedia says Swift is partially inspired by Haskell. The ReasonML website lists Swift as a similar language. From the "Tour of Swift" tutorial I read the type guards/constraints are ...
0
votes
0answers
23 views

Set UINavigationBar height proportionally to screen size

I have 5 tabs in UITabBarController and each of them is embedded in a UINavigationController. I would like to set the height of this tab to 8% of the screen, but I cannot set constraints to StoryBoard,...
1
vote
0answers
14 views

Swift Vapor Filter with field type Array containing a value

I am trying to create a method where Players can fetch their messages in a game. The message object has a property receivers which is an array of UUID containing Player IDs (in case messages are sent ...
0
votes
0answers
19 views

Dictation (Speech Recognition) text does not match a string in Swift

I have developed a speech recognition function that can detect Arabic audio and return a string, I assign it to a var called speechRecogText. Within the code I also have a text field which I store the ...
-1
votes
0answers
31 views

How to handle nested JSON in Swift [closed]

I am struggling with my nested JSON for days and I really hope you can help me with that. I have tried different types but there is always some kind of problem, like not loading in the background or ...
0
votes
1answer
19 views

UITableViewCell with automatic height and Autolayout

I'm creating an UITableView that cell have automatic heigh. Each cell have 3 UILabel that uses Autolayout: I think i have set all the constraints fine, however I'm experiencing something weird and is ...
1
vote
1answer
10 views

Extern ARSCNView to react native

I have a custom View using ARSCNView, let's say it's something like import Foundation import UIKit import ARKit import SceneKit @available(iOS 11.0, *) class ARSceneView: ARSCNView, ARSessionDelegate,...
1
vote
1answer
30 views

Programatically apply 2 different colors on same SVG at the same time in Swift

How can I change 2 different colors of an SVG in code in Swift? The SVG icon consists of an arrow and a circle. I would like to set color of an arrow separately from the color of a circle. Can I do ...
-1
votes
0answers
26 views

Text field not changing

The gist of the project is I type a question into the questionField, I hit the submit button, and the answer to my question is automatically shown in responseLabel. Before asking a question, however, ...
0
votes
0answers
6 views

Using NSMutableAttributedString how to wrap text beside image not under it

Here's how I'm achieving the first result using the following code, and I need to achieve the second result in the last image, thanks in advance var text = RechargeStrings.mada_instructions....
-3
votes
0answers
21 views

Cannot assign value of type 'UIColor' to type 'CGColor' [duplicate]

import UIKit class BlackBgView : UIView { override func awakeFromNib() { layer.backgroundColor = UIColor.black.withAlphaComponent(0.6) layer.cornerRadius = 10 } }
0
votes
0answers
12 views

Store Firebase Cloud Messaging Token in ViewModel SwiftUI Class

I am trying to integrate FirebaseCloud Messaging to my IOS App in Swift/SwiftUI. I've been trying to store the FCMtoken outside the App Delegate class but I don't how to obtain the value. I tried ...
0
votes
1answer
46 views

accessing segmented control selected index from another viewcontroller

I'm working on an app that currently has 2 view controllers. Within the second viewcontroller, (which I'm using for settings) I use a segement control in order to determine the game's difficulty. The ...
0
votes
1answer
27 views

How to load updated variable in SwiftUI before view initiation?

I am in the process of building a SwiftUI app but I am stuck with the initial value I am feeding a variable for initiation, and that it does not update when I load a view. I have tried looking for ...
0
votes
1answer
21 views

Retrieve data from array in another function

I am trying to retrieve the data set in an array in one function, in a different function. I appended the data i want into the OtherUserArray in the createNewConversation function. However when i try ...
0
votes
0answers
29 views

How to inherit class in SwiftUI View?

I am trying to convert my Swift App into SwiftUI. In My Swift App I am having one listener class inheriting in home class. In that home class one function is calling. (Home is Viewcontroller class) I ...
2
votes
1answer
26 views

SwiftUI offset animation problem while in preparing bottomsheet

I wanted to make a bottomsheet in SwiftUI with my own efforts, I open it using animation, but my animation doesn't work when closing, what is the reason? I wonder if the offset value is increasing ...
0
votes
0answers
13 views

IOS : Trying to build an app and want to incorporate 4k recording

We are trying to build a camera app. New iOS devices enable user to record in 4k with built in camera app, can we use the 4k functionality in our camera app too to record ? Attached the 4k iOS ...
0
votes
0answers
18 views

How are non-http request supposed to be sent in swift?

It's extremely simple to send http request in swift language with URLSession however I am currently struggling to figure out how to deal with RTMP requests for example, At which point sending an HTTP ...
1
vote
1answer
19 views

Resize UIButton inside StackView in Storyboard

I have started to learn Swift recently and have the following problem with an Auto layout: Have simple structure from the elements: 1 UILabel + 2 UIButtons inside a StackView and UIImage as a ...
0
votes
0answers
11 views

Get Point-Cloud Data from MDLAsset

I am trying to use the iPad Pro 2020/iPhone 12's LiDAR scanner to do some real-time data processing onto real-world geometry data. To reconstruct the scene I am using the sceneReconstruction "...
-1
votes
0answers
23 views

List with different data source

I'm using MVVM pattern and trying build List with 2 different data models. Model1: struct WeatherViewModel { let weather: Weather let id = UUID() var temperature: ...
-2
votes
0answers
19 views

Why is my preview of Apple Map's on SwiftUI not working?

Currently following the apple developer SwiftUI tutorial, and I'm currently on the part where MapKit is being introduced. Whenever I run the live preview the map is glitched as shown Any help is ...
0
votes
1answer
41 views

How do I add a placeholder to my UITextField? (Using Xcode 12)

EDIT: New ErrorCurrently using XCode 12, and I'm trying to add a placeholder. I followed the Swift QuestionBot documentation but it doesn't work (I'm assuming it's because my XCode is much newer). ...
0
votes
1answer
25 views

Display three reusbale cells in tableview - Swift 5

I have 3 UITableViewCell with XIB files but on my tableview I can't display my three UITableViewCell, only can load the first two func tableView(_ tableView: UITableView, numberOfRowsInSection ...
0
votes
1answer
24 views

swift: Cannot use mutating member on immutable value: subscript is get-only

import Cocoa struct MyData { let t: TimeInterval let q: Int } extension Collection where Index == Int, Element == [MyData] { mutating func add(_ new: MyData) { guard !self....
0
votes
1answer
21 views

What is this [__lldb_expr_19.Book] I'm getting in the console?

I'm practicing the CRUD functionality in MVC design. Below I have a Book model and a BookShelfModelController. Everything seems to be working appropriately, but when I print to the console, all I get ...
1
vote
0answers
25 views

Too Many Open Files in SpriteKit

I am developing a storytelling app with SpriteKit which tells a story page by page and offers simple games related with the story. Every page (SKScene) has approximately 10 images and a few sound ...
0
votes
1answer
43 views

How to filter 3 dimension array of object in swift

So I was supposed to filter the 3D array of objects based on the object name that contains a text by user input. The output should be the 1 flat array and the parent array should be included as well, ...
0
votes
1answer
26 views

SwiftUI how can I create unique sublists from user input

I’m trying to get my head around creating a simple sublist from user text field input. So if the user wants a sublist B inside sublist A, then sublist C inside sublist B and so on, endlessly. The way ...
0
votes
1answer
22 views

Collectionview dynamic height change with constraints not working in Swift

I am using collectionview in tableview cell and the hierarchy of tableview cell is like this topview constraints top = 0, leading = 0, trailing = 0, bottom => 0 ViewX constraints top = 0 leading = ...
0
votes
0answers
8 views

I want to pause ASVideoNode for invisible ASCellNode in ASTableNode while using AsyncDisplayKit

Hello i am building a app like tiktok where users can able to swipe through different videos.I am using ASVideoNode in ASTableNode and facing issue that previous ASCellNode videos does not pause when ...

1
2 3 4 5
6005