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.
Need this type of alert prompt for notification. iOS 15, Xcode 13 (beta)
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 -...
asked 13 mins ago
iDeveloper
1,76111 gold badge1313 silver badges3030 bronze badges
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 ...
When I try to Archive, I get the following error -
Multiple commands produce '/Users/kumar/Library/Developer/Xcode/DerivedData/project-giaimtwxkjihslcrnslgrczdvfrm/Build/Intermediates.noindex/...
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 ...
func putpers (_ req: Request) throws -> EventLoopFuture<HTTPStatus> {
let information = try req.content.decode(Pers.self)
return Pers.find(information.$user.id, on: req.db)
...
I had split the existing app into two targets. How to handle force update scenario here ?
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 ?
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 ...
asked 1 hour ago
user1591668
2,07544 gold badges2929 silver badges6363 bronze badges
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 ...
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 ...
asked 2 hours ago
fabiobh
59611 gold badge88 silver badges2121 bronze badges
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 {
...
asked 2 hours ago
ElKePoN
42411 silver badge88 bronze badges
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 ...
Let's say I'm trying to parse this particular JSON file with SwiftUI:
data.json
[
{
"number": 1,
"word": "hello",
"sentence": {
...
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 ...
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 ...
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:...
asked 6 hours ago
xytor
35233 silver badges1414 bronze badges
How to change font style & Font Color & BackgroundColor of the button for UIAlertAction
let alertController = UIAlertController(title:"Alert", message: "Message", ...
asked 6 hours ago
kiran
3,81155 gold badges4444 silver badges8686 bronze badges
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 ...
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,...
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 ...
asked 8 hours ago
Farini
89311 gold badge1818 silver badges3535 bronze badges
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 ...
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 ...
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 ...
asked 9 hours ago
Miguel
50444 silver badges2020 bronze badges
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,...
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 ...
asked 9 hours ago
SimpleApp
47444 silver badges1515 bronze badges
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, ...
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....
import UIKit
class BlackBgView : UIView {
override func awakeFromNib() {
layer.backgroundColor = UIColor.black.withAlphaComponent(0.6)
layer.cornerRadius = 10
}
}
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
asked 11 hours ago
Lucas
46755 silver badges1111 bronze badges
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 ...
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 "...
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: ...
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 ...
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). ...
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 ...
import Cocoa
struct MyData {
let t: TimeInterval
let q: Int
}
extension Collection where Index == Int, Element == [MyData] {
mutating func add(_ new: MyData) {
guard !self....
asked 13 hours ago
Anton
29944 silver badges1515 bronze badges
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 ...
asked 13 hours ago
Josh
55355 silver badges1111 bronze badges
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 ...
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, ...
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 ...
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 = ...
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 ...