swift4 Questions

4

I am trying to map my data to Model. Where I am using Firestore snapshot listener, to get data. here, I am getting data and mapping to "User" model that; do{ let user = try User(dictionary: temp...
Gluconeogenesis asked 18/12, 2019 at 10:38

6

Solved

How to get the current date in unix-epoch? timeIntervalSince1970 prints the current time. Is there any way to get today's time at 12 AM? For example, The current time is : Jan 7, 2018 5:30 PM. tim...
Stepheniestephens asked 8/1, 2019 at 1:10

1

On running the following code: let pid = getAppPid() let AXApp = AXUIElementCreateApplication(pid) var children: CFTypeRef? let returnVal = AXUIElementCopyAttributeValue(AXApp, kAXChildrenAttrib...
Blakey asked 6/11, 2017 at 19:13

4

Solved

I have searched, and I cannot find an example. I have also tried adapting this code (recommended elsewhere (CloudKit won't reset my badge count to 0): func resetBadgeCounter() { let badgeRese...
Newsboy asked 28/11, 2017 at 22:28

7

Solved

I did a core-data model: class Order: NSManagedObject { ... //code } but when I try to build I get an error: 'Order' is ambiguous for type lookup in this context
Kismet asked 25/9, 2018 at 10:59

4

Solved

In trying to serialize an array of float3 objects with the basic JSONEncoder, it's revealed that float3 does not conform to the Codable protocol, so this cannot be done. I tried to write a basic e...
Folberth asked 29/1, 2018 at 1:45

4

Solved

I am trying to use FSCalendar in one of my project to selecting range of dates. What I found is this library have Swift version however range selection version is only available with Objective-C. ...
Sparker asked 16/4, 2018 at 11:37

6

Say I have the following code: import Foundation let jsonData = """ [ {"firstname": "Tom", "lastname": "Smith", "age": {"realage": "28"}}, {"firstname": "Bob", "lastname": "Smith", "age": {"fak...
Flashing asked 13/10, 2017 at 6:17

1

AFAIK, Swift class can be assigned by literal value by conform to ExpressibleBy*Literal . For example, class A can be assigned by Int like this, which is similar to implicit construction in C++ c...
Nievelt asked 12/10, 2017 at 3:35

4

Solved

I have defined a enum like this: enum ClubLevel: Int, Codable { case golden = 1, silver, bronze } in my struct I have an optional property of type ClubLevel and when I decode this property in i...
Fondea asked 20/12, 2017 at 12:31

12

Solved

I have defined an enum as follows: enum Type: String, Codable { case text = "text" case image = "image" case document = "document" case profile = "profile" case sign = "sign" case inputDate ...
Punjabi asked 6/4, 2018 at 15:6

4

I have an app which works nice and without any problems on iOS 10 but with iOS 11 and Xcode Beta 5, I have this strange problem with search bar scope where the scope bar seems like it was cut from ...
Computerize asked 20/8, 2017 at 13:30

3

I have tried the earlier examples of asking permission to add items to the IOS calendar. They do not work with Xcode 10.1 (Swift 4.2). When I try to compile the code, I get an error. If I comment o...
Rombert asked 22/11, 2018 at 6:32

3

I have been going through the recent swift docs and working out on few examples in understanding private and fileprivate keywords in swift4. I am trying to access a fileprivate and private variable...
Wintery asked 31/10, 2017 at 11:9

4

Hi I'm trying to create a custom SessionManager in Alamofire in order to change the default timeoutIntervalForRequest value. I'm using the code below: let configuration=URLSessionConfiguration.de...
Hazlett asked 26/5, 2018 at 8:59

4

Solved

I'm trying to access the photo library to import a profile image in swift 4. but i got this error : This app has crashed because it attempted to access privacy-sensitive data without a usage d...
Hedelman asked 14/11, 2018 at 19:27

10

I just installed XCode10 and I am trying to run my code on ios8 simulator, in the process I am facing below error "Build service could not start build operation: internal error: failed to send the...
Leonie asked 21/9, 2018 at 6:24

3

Solved

I'm starting to rewrite an application and I want to use Swift 4 Codable protocol to automatically convert json string to Objects and Structs. Sometimes, specially at the beginning of coding, I en...
Pelota asked 27/9, 2018 at 14:33

7

Solved

How can you get a string value from Swift 4 smart keypaths syntax (e.g., \Foo.bar)? At this point I'm curious about any way at all, does not matter if it's complicated. I like the idea of type inf...
Desai asked 2/10, 2017 at 15:46

6

Solved

I have an API that will sometimes return a specific key value (in this case id) in the JSON as an Int and other times it will return that same key value as a String. How do I use codable to parse t...
Mckale asked 22/12, 2017 at 4:4

5

Solved

So I have an API route that returns a JSON array of objects. For example: [ {"firstname": "Tom", "lastname": "Smith", "age": 31}, {"firstname": "Bob", "lastname": "Smith", "age": 28} ] I'm try...
Zoophobia asked 29/8, 2017 at 0:7

8

Solved

Here is my JSON { "id": 1, "user": { "user_name": "Tester", "real_info": { "full_name":"Jon Doe" } }, "reviews_count": [ { "count": 4 } ] } Here is the structure I want it saved to (...
Bethune asked 14/6, 2017 at 15:47

3

Working on a project in swift, where I'm trying to initiate the AVPlayer, and for some reason it trows me an exception saying AudioHardware.cpp:1200:AudioObjectRemovePropertyListener: AudioObje...
Kubis asked 29/11, 2017 at 11:56

3

Solved

Thanks in advance for help, I have two API calls, both are concurrent and any call could be success first(I don't want call in sequence), after success of both calls, I have to stop my activity ind...
Klaraklarika asked 27/5, 2018 at 23:32

1

I am getting list of data need to show at bottom like new tricker in iOS automatic smooth and continuous Scrolling. how to achieve that kind of behaviour like Marquee to collectionView because I ne...

© 2022 - 2024 — McMap. All rights reserved.