How to Change the status bar color using ios with swift on internet reachability?

Swift
i want to change the color of my device status bar if the internet is connected than the status bar color should turn Black and if the internet is not...
2 years ago

How do I import a Swift file from another Swift file?

Swift
I simply want to include my Swift class from another file, like its test PrimeNumberModel.swift import Foundation class PrimeNumberModel { } Prim...
2 years ago

IBDesignable Errors When Adding to Tests Target

Swift
I have a simple UIButton subclass that implements IBDesignable with an IBInspectable var: @IBDesignable class Button: UIButton { @IBInspectable v...
2 years ago

Remove the last occurrence of an element in a Swift array

Swift
I need to remove the last occurrence of a specific element in a [Bool] Array. For example in JavaScript this would be: var k = [true, true, false]; k...
2 years ago

Swift: NSScrollView containing NSTextViews Doesn't Scroll Properly

Swift
I have an NSScrollView in which I wish to display several NSTextViews as shown below. (Much like here and here). I am adding all the different NSTextV...
2 years ago

Swift conditional binding on array

Swift
Is there a way to use if let on an array. If the array has a value at index let it equal this value. if let view = self.view.subviews({$0.tag == 1 })...
2 years ago

How to convert from a Swift String Set to an Array

Swift
I am trying to create an array of words from a string object retrieved from Parse. The object retrieved looks like this: Then this line of code giv...
2 years ago

All collisions working except for one. What do I do?

Swift
I have a square consisting of four different colors in the middle of my scene. At the same time, I have smaller squares of the same color randomly gen...
2 years ago

Easy way to 'Insert Background Music' in Swift Xcode

Swift
My sound file name is : bensound-november.mp3 and I want play infinitely this Music File. I use blow code. please suggest simple code fit with this co...
2 years ago

iOS Swift - Offline Availability

Swift
I'm building an app with iOS Swift and I'm new in this domain. I require some contents to be available while offline, like user details, their curre...
2 years ago

Remove tab bar item text, show only image

Swift
Simple question, how can I remove the tab bar item text and show only the image? I want the bar items to like in the instagram app: In the inspec...
2 years ago

Show UIPickerView text field is selected, then hide after selected

Swift
I am trying to create a text box that when it is selected a UIPickerView opens up with choices to select from. Once selected, the UIPickerView hides a...
2 years ago

Get the custom UITableViewCell that contains the UIButton pressed

Swift
So I have a custom UITableViewCell class: class customCell{ let button1 = UIButton() let view1 = UIView() view1.frame = CGRectMake(3...
2 years ago

Replacing html tag with null in XML string

Swift
I want to replace <![CDATA[ tag in xml string with null but I don't know how to find or grab this tag using regular expression in swift 2.0 My xm...
2 years ago

How to Convert UNIX epoc time to Date and time in ios swift

Swift
I'm trying to convert the UNIX epoc time to datetime format using the below code var epocTime = NSTimeInterval(1429162809359) let myDate = N...
2 years ago

Xcode doesn't load image from CUICatalog

Swift
When running my code I get two errors: CUICatalog: Invalid asset name supplied: and "Could not load the "" image referenced from a nib in t...
2 years ago

Can I use generics to cast NSNumber to T in swift?

Swift
What I want func safeGet<T>() -> T { let value = magic() if let typedValue = value as? T { return typedValue } } The r...
2 years ago

How to access an array of dictionaries in Parse API

Swift
I saved an array of dictionaries to Parse, which appears correctly in the User class. I can po user at a breakpoint and the array shows up properly as...
2 years ago

Unable to reference class variable require 'self' keyword

Swift
How to get holidays to be updated when using the self keyword? When access outside the particular function the variable is still empty. The below code...
2 years ago

How to pattern match types conforming to a protocol

Swift
I would like to write functions that match a type pattern like this (just example code): protocol Event {} enum LightsEvent: Event { case Switc...
2 years ago