1,018
questions
1
vote
0
answers
70
views
Issue Overcoming Missing Values in API App
I was playing with a Swift app someone made on Youtube that accesses the Google Books API and returns the results of a (hard-coded) query. While playing with it, I noticed it kept crashing. Playing ...
0
votes
1
answer
205
views
Unable to parse Json properly with SwiftyJson
I have the folllowing Json response:
` [Body]:
{"id":"cmpl-6Z45N6vfd2312vdfqyYPb8aDRVe9Nft7vfnpoEsL","object":"text_completion","created":...
-1
votes
1
answer
333
views
No Such Module Moya
I am Using xcode 13.4.1 and installing pod 'SwiftyJSON', '~> 4.0'
pod 'Moya', '~> 15.0' these pods successfully i can't import these pods in my class.
1
vote
1
answer
35
views
Using Swifter to pull a twitter list will only pull tweets with media links and not ones with full text based on my case let statement in SwiftUI
I am currently building an app to display tweets from a twitter list. For some reason I am only appending tweets with media links, and skipping over tweets with just full text and no media. The JSON ...
0
votes
1
answer
139
views
Undefined Symbol: SwiftyJSON - Unit Testing
I've been looking at how to fix this bug extensively without success. Currently, I'm using Xcode 14. I don't know if this has something to do with these errors.
Basically, they appear when I try to ...
1
vote
1
answer
62
views
Invalid type in JSON write (.SurveyAnswer) - SwiftyJSON
Something must be wrong in my model because my project fails with this error whenever this function runs.
func communityGroupPost(postUtil: PostShareUtil, success: @escaping (ResultModel<BaseModel&...
1
vote
0
answers
55
views
Load Various Custom Views inside 'some View '
I've been working on a SwiftUI project that generates UIs based on Server responses using JSON
In order to do that I have created a FormBuilder
Now I want to show various types of custom fields like ...
0
votes
3
answers
3k
views
Swift 5 : Create JSON with Codable / Struct from my variables
I would like to create a Codable structure to save data from a user profile.
Let's say the iOS user filled a form with his name, last name, address, put his picture (UIImage) and that user have a ...
0
votes
1
answer
933
views
Alamofire 5 - DataRequest with SwiftyJSON as response
Before you tell me to use Decodable for all the models, and you would be right, I am trying to fix a project in the time the client has allocated. Changing all models to Decodable, and all the places ...
0
votes
1
answer
115
views
How do i populate three sections in a tableview with SwiftyJSON
I want to assign records or cells for 3 sections ["Managers","Accountants","Receptionist"] where key "authority" has the validation of which section it belongs ...
0
votes
0
answers
961
views
Swift fix Cannot assign value of type '()?' to type '[ShopData]?'
im stuck resolving my problem for over a week and i dont know how, im junior.
i want to get an array data from the dictionary data which both has the same name in backend = "data",
"...
0
votes
1
answer
81
views
how to populate cells in a UItableview with switfyJson from an alamofire post request
I have a Tableviewcontroller embedded in a Viewcontroller. And i would like to populate this 3 cells with data from my alamofire post request. whats the easiest way to get that done? i can see my ...
0
votes
0
answers
43
views
remove extra objects from string or array while hitting api
I wanna pass whole array to api which expects string. My "education" expects any string like "education" : "ncert" but I wanna pass multiple elements to it. So to pass ...
0
votes
0
answers
55
views
Parse and mapping data in tableview with Alamofire and SwifrtJSON with completion handler(@escaping)
I have data models. I make a request and get JSON. But I want to use the completion handler to add data to the table. How do I save data and display it in a tableview? I didn't use the entire data ...
0
votes
0
answers
430
views
How do I create a Package.swift file for a package in Xcode's package manager?
I'm trying to use SwiftyJSON within an Xcode project via the built in package manager. The first time I try to add it through Xcode, The app complains about missing Swift-tools version specification ...
-2
votes
1
answer
183
views
SwiftyJSON data is only using the first element of my json
I'm using Alamofire and SwiftyJSON and I'm getting my data, but my view is only repeating the data for the first element of the JSON. The data should be Monday, Tuesday, Wednesday, and so on
[![enter ...
0
votes
1
answer
136
views
Get multiple strings from JSON
So the JSON variable let json = JSON(nearbyChargingSites.jsonString!) contains the current data.:
{
"timestamp" : 1626902257093,
"superchargers" : [
{
"location&...
1
vote
0
answers
23
views
why i cant get the json from this scrip in php using alamofire?
i wrote this script to sign in the user in PHP in order to save the data to the server, if the user has been created the scrip should return a simple json with true or false.
<?php
require ".....
0
votes
0
answers
42
views
understand why fail to return the json from a php script when using respondJSON in alamofire
I wrote the following script in PHP in order to signup the user in a MySQL table.
<?php
$host = "127.0.0.1";
$user = "root";
$password = "";
$database = "...
0
votes
1
answer
318
views
No such module 'Alamofire' - Xcode 12
I'm trying to import Alamofire to a Swift 5 Xcode project (Xcode 12, iOS 14.4) but I'm getting the 'No such module'Alamofire'' error message.
The Cocoapods for the latest Alamofire and SwiftyJSON ...
0
votes
1
answer
395
views
Use SwiftyJSON to convert tuple array to JSON string
I wanted to convert a simple array of tuples like this to a JSON string using SwiftyJSON:
let tupleArray: [(Int, Int)] = [(1,1), (2,2), (3,3)]
let tupleArrayAsJsonSttring = JSON(tupleArray)....
-1
votes
2
answers
210
views
How to convert array to dictionary with SwiftyJSON?
I restructured my endpoint return and want my front end code to work with the old way. I have 3 values in an array and would like to convert it to a dictionary [Int64: JSON]. I'm using SwiftyJSON. ...
0
votes
1
answer
740
views
Successfully write JSON to Realm DB using swiftyJSON in Swift
I am trying to write to a Realm DB from JSON file (using swiftyJSON) get the following error:
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to ...
-1
votes
1
answer
518
views
value becomes null after function swift
I've been practicing swift in a couple of days now, just stuck with this problem when after calling a function getItunesData() the model var songItems: [SongItem] = [] becomes nil.
I've tried ...
1
vote
1
answer
562
views
Cannot assign value of type '[JSON]' to type '[MyStruct]'
I'm learning to use SwiftyJSON and I'm trying to convert the resulted values into an array of MyStruct. However, whenever I try that, it tells me that they are not compatible. How can I convert [JSON] ...
0
votes
1
answer
41
views
Having trouble appending value from JSON Parsing to array in Swift
I'm playing around with https://jsonplaceholder.typicode.com and I'm trying to create a list of the albums. I tried following the example here, but the list of album titles isn't showing up on the ...
1
vote
1
answer
78
views
responseJSON json parse in Alamofire
I am getting json form server. But json parsing nil in swift. Here is my json
{
"out_code":"0",
"out_message":"0",
}
I tried bellow code to out_code ...
0
votes
1
answer
731
views
Update JSON Array in Swift 5
I have a JSON array fetching from url and convert using SwiftyJSON. Now i want to update some value of JSON Array for some functionality.
My JSON is like
[
{
"id" : 48845152,
...
0
votes
1
answer
202
views
Parse JSON response with SwiftyJSON
I have the following code and I am trying to get values using SwiftyJSON:
let string =
"""
{"ResponseMetadata": {"RequestId": "b5d6ecad-e050-4d1f-...
0
votes
2
answers
969
views
How can I convert a JSON as Data Type in Swift?
I want to send data to my websocket server in swift but the websocket server write function only accepts strings or the data type. Since I did not find any JSON.stringify option for swift I used ...
-3
votes
1
answer
58
views
Parse Alamofire result swift
I'm very lost parsing the following response from an AF request – let json = result as! NSDictionary – in Swift:
{
errors = (
);
get = statistics;
parameters = {
...
0
votes
1
answer
62
views
How create a usable data object
I have swiftyJSON added as a package dependancy and have the appropriate import statement.
My JSON file has the following format:
"00AK": {
"icao": "00AK",
...
0
votes
0
answers
169
views
`keyNotFound` error when creating object from Gmail API Response with Swift on iOS
I'm using Alamofire to get emails from the Gmail API via the message IDs:
AF.request("https://www.googleapis.com/gmail/v1/users/me/messages/\(id)?format=full", headers: headers)
...
1
vote
1
answer
437
views
Fatal error: Can't compare indices belonging to different collections:
I'm getting a strange error when iterating over the contents of a SwiftyJSON object.
I initialise the object and pass to a function which converts the JSON to a dictionary suitable for a POST request
...
0
votes
3
answers
592
views
framework not found SwiftyJSON
I'm getting that "framework not found SwiftyJSON" error after pod update. I have tried many clean build folder and project. But It still stays in there. What should I do?
my pod file
...
0
votes
1
answer
103
views
SwiftyJSON convert string array to array not working
I have data as below:
data =
[
"\u65b0\u5317\u5e02\u4e09\u91cd\u5340","\u65b0\u5317\u5e02\u6c38\u548c\u5340",
"\u53f0\u5317\u5e02\u4e2d\u5c71\u5340","\u53f0\u5317\...
-1
votes
1
answer
58
views
Loop JSON requests to backend (REST API)
I am sending request to the backend (REST API). My task: If the JSON response does not come in the required format, or returns an error, then start the request cycle - 3 attempts, and if these three ...
0
votes
1
answer
52
views
SwiftyJSON not working with WebSocket message
I have a socket response that is this:
{"op":0,"d":{"author":{"id":"6699457769390473216","name":"Test","verified":false},...
1
vote
2
answers
238
views
How to use SwiftyJSON to parse data with abiguous types?
I have JSON structured like this:
{
"data": [
{
"value":["val1", "val2", "val3"]
},
{
"value":"val"
}...
0
votes
0
answers
99
views
Trying to get JSON from a server, but i keep getting an error saying it's invalid
I'm having a problem with my code where I'm using AlamoFire and SwiftyJSON trying to get a JSON from a server, however, I keep getting this error:
responseSerializationFailed(reason: Alamofire.AFError....
1
vote
3
answers
322
views
swifty json parse array object
how can I set an array of Images to an images variable of the Car class
my json:
{
"Description": "test comment",
"GalleryId": 5548,
"ShortCode": &...
-1
votes
1
answer
194
views
Get JSON Object from JSON Response in Swift
I want to fetch LoginOperationResponseBody key from the following JSON response in Swift.
[
{
"LoginOperationResponseHeader": {
"ReponseCode": 1,
...
0
votes
3
answers
2k
views
How to parse JSON from Yahoo Finance in Swift for MacOS
I've been struggling with this one! I've got Alamofire and SwiftyJSON. I use Alamofire to get a JSON result from Yahoo Finance like this:
public func getYahooQuote(symbol: String) {
let ...
1
vote
1
answer
254
views
SwiftyJson get value from array in dictionary
I've been trying to retrieve the value of code for a while now. This is the json I'm getting back from the server:
{
"message": "The given data was invalid.",
"errors&...
1
vote
1
answer
790
views
How to concatenate two json objects with Swifty JSON
I'm using Swifty JSON (https://github.com/SwiftyJSON/SwiftyJSON). I have searched and found a close one here (How to combine two SwiftyJSON objects). I have exactly the same question. But the answers ...
1
vote
1
answer
187
views
Parsing JSON with multiple identical identifiers in Swift
Im trying to parse JSON data from an RestAPI that gives me energy data for Norway (https://driftsdata.statnett.no/restapi/ProductionConsumption/GetLatestDetailedOverview)
<...
1
vote
1
answer
364
views
Why am I getting nil for the Int64 value?
I run this code and get clients names correctly, but when it comes to integers (number of awards, number of cars, number of dogs), it seems that I am not getting anything from the API (the ‘?? 0’ part ...
0
votes
1
answer
49
views
Requesting URL and Parsing The Result In A Alert
I have made the variables global, but I have not been able to figure out how to show the alert after it has gotten the response. Not sure if I have to create function or not. Anything would be helpful....
0
votes
1
answer
96
views
How to post Data on server in it's actual format?
I am posting my parameters data on server as below.
let parameters : [String : Any] = [
"cartdata" : cartArr, //cartArr is an array
"previewcart&...
0
votes
1
answer
4k
views
Swift - Type '(String, JSON)' cannot conform to 'StringProtocol'; only struct/enum/class types can conform to protocols
I'm using SwiftyJSON. Ultimately I want to see if the "date" value equals the value of selectedDate and if so, print the "event" value.
But I haven't even got that far yet. I'm ...