let timeFont = [NSFontAttributeName:UIFont(name: “Voyage”, size: 20.0)]
var attrString3 = NSAttributedString(“(Time)”, attributes: timeFont); // <--- compiler error "Extra argument in call" This co
Tag: SWIFT
Swift error: ‘Sequence’ Requirements Type ‘T’ and ‘ArraysLice’ is equivalent
I am trying to update the math library to be compatible with Swift 3, but I encountered an error:
‘Sequence’ requires types’T’ and’ ArraySlice’ is equivalent to
The Apple documentation
How to get the current time of SWIFT?
I want to get the current time, so far I have completed this:
let date = NSDate()
let calender = NSCalendar.currentCalendar()
let components = calender.component([.Hour, .Minute], fromDate
SWIFT: How to set anyobject to nil or equivalent
I have a very general function that needs to return AnyObject:
func backgroundFunction(dm: DataManager) -> AnyObject {
…
} But in some cases I want to return an empty/null value
I th
Swift 4 JSONSerialization.jsonObject
I am using Xcode 9.2 and Swift 4. How to check whether the returned json data is empty?
Now it gives me error if json [0] [“data”] type’Any’ has no subscript member in the line
var json: NSM
SWIFT – Using the Alamofire and ObjectMapper, the integer value is always zero
I am using Alamofire and ObjectMapper, my model class is like this
class Category: Object, Mappable {
dynamic var id: Int = 0
dynamic var name = “”
dynamic var thumbnail = “”
var children = L
How do I decode the JWT (JSON Web token) token in SWIFT?
p> p> eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ p> blockquote > How do I decode this so that I can get the payload like this
{ “sub”: “1234567890”, “name”: “John Doe ”, “admin”: true }
How to add a map view of Google Maps for iOS in SWIFT
I tried to add a marker on Google Maps, but the application crashed when the addMarker() function was called. The exception details are as follows,
The catched exception’GMSThreadException’ t
SWIFT: OPTIONAL’s useless default?
I am creating a function like this:
func foo(bar: UInt? = 0) { let doSomething = someOtherFunc(bar!)
) If I pass a zero value to foo(), I want to use the default value 0 when opening it, not
SWIFT3 – Error via the Cocoapods installation field
I encountered this strange error when installing realm on xcode 8, cocoa pods version cocoapods-1.2.0
The error is –
Installing Realm (2.4.3)
[!] /bin/bash -c
set -e
sh build.sh