Newest 'swift' Questions - Stack Overflow

Questions tagged [swift]

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

0
votes
0answers
7 views

MapBox geojson features by predicate always returns empty array

I have an IOS (Swift) app that uses MapBox. My map has a POI layer that is loaded from a local GeoJSON file. So far so good, it appears as expected. Now I'd like to make some filtering operations ...
0
votes
0answers
8 views

Removing content in PencilKit

When using PencilKit in iOS 13/iPadOS, how do you remove all content from screen, or remove those content selected (via lasso)? I can't find any functions in PKDrawing or PKCanvasView that do these?
0
votes
1answer
21 views

convert and format string to an array of characters in swift

how do I convert this string to an array of characters ignoring the first 2 characters and line breaks (\n) or spaces ? so I do have this: var leds = """ 1 1 XXX 000 00X """ to return this to me as ...
2
votes
0answers
9 views

Dealing with Firebase childDeleted and childModified observers Swift

In my app I have set observers for childAdded, childDeleted and childModified on the Firebase database nodes of interest to keep track of them and modify my CoreData device database accordingly. I ...
-1
votes
0answers
14 views

MiGS (MasterCard Virtual Payment Client) integration in iOS swift

Can anybody explain how to integrate third party payment migs (MasterCard Virtual Payment Client) in iOS? Anyone who has done a similar project or has any clue as to what am missing here, can be of ...
1
vote
0answers
13 views

How to send user health data to server periodically in iOS

I'm trying to make an application, which collects user data from HealthKit and CMMotionActivities from CoreMotion and sends it to server. Since CoreMotion contains a lot of CMMotionActivity records, I'...
0
votes
0answers
16 views

Decoding optional List of objects in RealmSwift class

I am trying initialize Codable List of objects in Realm class, the problem is that the app crashes when server return empty list this is the code for initializing List class TicketDetails: Object, ...
0
votes
0answers
6 views

RestKit: Multiple response descriptors for same path patter and method

I have a GET web service which I am calling in two different ways, once with parameters to the web service and once without parameters. Although the response structure is the same in both cases the ...
1
vote
0answers
27 views

iOS Charts - Bar Chart repeating labels on X axis

I have made a bar chart with 6 groups and I have manage to hack my way into centering them exactly below each group. Now, the problem is that the value inside of each label is repeating. My values ...
0
votes
0answers
11 views

Get own Bluetooth unique id

My question is how can we detect our own device's unique bluetooth ID (must be available from other device when we scan for nearby available bluetooth) I tried this CBUUID *myService = [CBUUID ...
2
votes
1answer
48 views

iOS- use of undeclared type viewcontroller

I am trying to switch from one controller to another. But the error shows undeclared type. I have import UIKit on the controller but that also didn't work. let storyboard = UIStoryboard(name: "...
0
votes
1answer
23 views

Slow down processes in didReceiveMemoryWarning()

Is there anyway to slow down the processor when RAM reaches an x amount of memory or when didReceiveMemoryWarning() gets called? func didReceiveMemoryWarning() { super.didReceiveMemoryWarning(); ...
0
votes
0answers
11 views

The AVFoundation method: try loadingRequest.persistentContentKey(fromKeyVendorResponse: responseData!, options: nil) returning exception. Why?

Why I am getting this exception while calling a method: try loadingRequest.persistentContentKey(fromKeyVendorResponse: responseData!, options: nil). I am trying to play a fairplay stream in offline ...
2
votes
4answers
48 views

How to create an enum where few cases contains extra properties

I need 5 file objects to upload. Few files have date, few files have image. What is the data structure should I use? I tried to create an enum enum File: String, CaseIterable { case a = "A" ...
1
vote
1answer
15 views

Zoom past ImageView bounds

I've been following an article that shows how to reproduce Instagrams zoom on images. It works fine, but when I zoom, the image does not go past the bounds of the ImageView. As you can see in the ...
0
votes
1answer
15 views

Different scroll behaviour in Safari and WKWebview

why is the horizontal scroll is different when I open this link in wkwebview and safari ? This is my code so far. func wkwebViewLoad() { guard let urlString = NSURL(string: "https://docs....
0
votes
1answer
15 views

Swift Image Custom Multi Point Crop and Save

My Scenario, I am trying to implement photo gallery picked Image and camera captured Image move to photo edit ViewController. Here, I need to implement multi point adjustable cropping functionality. I ...
1
vote
1answer
18 views

Swift: NFCError Code=202 “Session is invalidated unexpectedly”

I'm trying to use NFC. I followed those steps: Enabled NFC in the AppID configuration Created a provisioning profile and installed it Added NFC capability to the target Added the privacy ...
2
votes
4answers
53 views

How to hide keyboard in TableViewController when tap on other cell?

I have TableViewController with UITextFields as cells and cells without TextField. I would like to hide the keyboard when I tapped on another cell without TextField
0
votes
2answers
42 views

Why doesn’t 'self.navigationController?.pushViewController(mainPage, animated: true)' work?

I am making a basic app that lets users sign up and login and they will be directed to the main page which has horizontal scrolling and paging enabled. The main view has 3 views which you can swipe ...
-1
votes
0answers
21 views

Is there any issue when drag marker from one location to another location?

First, if I long press marker and then drag marker from current location to any custom location, but I found when I drop marker its take me center of map only. -> I set delegate -> scrollGestures is ...
2
votes
0answers
22 views

Unable to scan QR Code using Pod - “QRCodeReader.swift” for version 8.2.0

In my project I m using Pod - "QRCodeReader.swift", version 8.2.0. Code Repo: https://github.com/yannickl/QRCodeReader.swift The above mentioned version of the pod has an issue that sometimes it ...
0
votes
3answers
27 views

Placing buttons on FSCalendar UIView

I'm trying to achieve this calendar (image attached), by using FSCalendar, All works fine except, any button I add inside FSCalendar UIView is un-clickable in simulator, I do have gesture ...
2
votes
0answers
32 views

Tableview offset changed after reload data

Tableview offset changed after reload data. 1 Dynamic row height using auto layout. 2 Using Navigationbar and tabbar in UIViewController. 3 Using 2 header in tableivew (My 1st and 2nd ...
0
votes
0answers
19 views

Find IP address of Mac system in Swift

I need to identify IP address of a Mac system in swift. I know there are some c++ and objective c way of doing this. But I'm looking for a pure swift version. Is it even possible? If so how to do it?
2
votes
0answers
28 views

How to Change Sound Wave Swift

I found how to create Sound wave From FDWaveformView Pods , but I can't modify to create a this type of wave screenshot below: Here is what I am trying to do: The screenshot is taken from Iphone: ...
0
votes
2answers
28 views

Swift - Reading different types of values from a dictionary

Presently the code that I have is reading all the values as String. However at times when an integer or decimal values are present, it gets read as nil. Present code: let fieldName = String(arr[0]) ...
0
votes
0answers
8 views

In Apple’s ML 3, can we get image model coordinates and size

In ML 2 we could train our machine learning model using play ground. But there were several important missing parameters like location and size. Our trained image model could have been discovered in ...
0
votes
0answers
25 views

When pressing a specific button, it crashes the app

When I press a specific button (Who's Next) it crashes the app. Though when pressing the other buttons those appears to work as expected. I have created all buttons with the same "method", and a lot ...
1
vote
0answers
6 views

Swift MacOS Grab window id of focused window

I have created a menu bar app, and I was wondering if there is a way that I am able to get the window ids of other applications when they are in focus, or being dragged? Currently I know I can use ...
-1
votes
0answers
9 views

How do you turn MapKit into a following Gps?

I just want to make an app that acts like a GPS where there is a pointer and the viewer behind it, so that I can see what streets to turn, I will be tweaking it from there. All I need is a GPS where ...
0
votes
2answers
28 views

change tableview cell content on collection view cell selection

I have a tableView and collectionView in one view controller. in tableView I have title description and in collectionView I have lable . I want on collectionView label selection tableView content ...
0
votes
2answers
47 views

How implement codable for Array of dictionary with dynamic keys for using Swift 4

API Response is like this "status": "SUCCESS", "mobile": "8856969696", "demo": [ { "data1": "some" }, { "data2": "value" } ], "pay": "12", } and im trying to ...
3
votes
1answer
29 views

This SwiftUI animation should only fade out. Why does it move to the right?

I'm having a hard time understanding why this happens. I reduced the problem to its minimum expression. I have a single Text view, that when removed, should just fade out. The .transition(.opacity) ...
0
votes
0answers
29 views

UserNotifications are coming when i installed ,my app in release mode but not coming in live app

I am making this certificate for live productionI have created apple notification production certificate and sending device token and type through api. But notification are not coming in live app but ...
-1
votes
0answers
21 views

Design patterns iOS - Swift - Coordinator, MVP and MVVM

I need advice on which design pattern to adopt or recently in-usage for large applications(having DB storage, web-service interactions etc.), keeping in mind: Harnessing the latest swift coding ...
1
vote
2answers
29 views

How do i add doneaction and change the done text?

I am using IQKeyboardManager and i added custom action for the done button txtfield.addDoneOnKeyboard(withTarget: self, action: #selector(doneButtonClicked), titleText: "Next") IQKeyboardManager....
1
vote
1answer
25 views

How should I comprehend the NavigationView declaration Code in SwiftUI

The declaration of 'NavigationView' in SwiftUI is so confusing.(Maybe I don't good at the Swift.) In the declaration 'NavigationView' is a struct, but the initializer even has no body, just like a ...
0
votes
0answers
12 views

collision between 2 sprites where one is bouncing off the other

I have a sprite that i initialized as a SKSPriteNode bouncing continuously off another sprite also initialized the same way. I can't figure out collision between the two, and nothing on stack has ...
0
votes
0answers
15 views

Can we get only continues slider value ?I want to minus the values that are forwarded or reverse by the user from the maximum value of slider

Right now I am working on music application. I have default slider that is handle by music’s starting range and music’s total duration i.e slider’s maximum value. If user forwarded the music I want ...
0
votes
0answers
23 views

How to create a fetch to sum over the difference between attributes

In the entity Shift I have two attributes startTime and endTime, I want to take the difference and then sum over all fetched values. let fetchRequest = NSFetchRequest<NSDictionary>(entityName: "...
-3
votes
2answers
44 views

convert base64 to image while not connecting to internet

i am implementing sqlite in my swift project and i am storing base64 string of image in sqlite table then after i am retrieving back base64 image but my scenario in that when user access offline mode ...
2
votes
1answer
39 views

How to setup Horizontal UICollectionView with paging, but items per page arrange from left to right & top to bottom

I had complete setup Horizontal UICollectionView with paging, but currently items per page is arranged from top to bottom and left to right, Now I want that items arrange from left to right & top ...
0
votes
0answers
22 views

How to add a .framework as dependency to a swift package in Xcode?

I want to know if there is anyway to link a swift package against a framework like SQLite.framework in Xcode? I'm trying to make a swift package for a sqlite library wrapper. Here is my current swift ...
0
votes
1answer
17 views

Swift: textView method “scrollRangeToVisible” not working after changing UI Text View size in storyboard?

I'm new to swift. When my UItextView is filled up, I would like to have my UItextView to automatically scroll to what I have typed (bottom of UItextView). I used scrollRangeToVisible and it had ...
0
votes
0answers
21 views

How to implement a login system similar to Hinge app [on hold]

I am currently trying to design a login system similar to Hinge. I have a LoginViewController that will obtain a token from the Facebook SDK. After the token is obtained, I will setRootViewController ...
0
votes
0answers
11 views

Art-Net for Swift

Is there an Art-net Library for swift MacOS? I am trying to send DMX to control lights connected to a ArtNet -> DMX node. Could someone let me know of a library or another way to control this
0
votes
2answers
41 views

How to load all data into picker view

How to load all data into picker view, now I can load first data only this is my data from JSON​ response **jsonResponse ==> Optional([["PlanDate": 18/01/2019, "PlanDateFullFormat": 20190118], ["...
0
votes
2answers
36 views

Xcode 11 beta swift ui preview not showing

Just playing with Swift UI basic app and the preview canvas is not showing even though I'm in canvas mode. App runs, and I have this little snippet what am I missing? #if DEBUG struct ...
1
vote
2answers
17 views

Swift Realm delete Object error- write transaction

I am deleting a Realm object and am getting this error: Terminating app due to uncaught exception 'RLMException', reason: 'Can only add, remove, or create objects in a Realm in a write transaction - ...