tagged [swift]
Delaying function in swift
Delaying function in swift I don't have a code to sample or anything, because I have no idea how to do it, but can someone please tell me how to delay a function with swift for a set amount of time?
Why Choose Struct Over Class?
Why Choose Struct Over Class? Playing around with Swift, coming from a Java background, why would you want to choose a Struct instead of a Class? Seems like they are the same thing, with a Struct offe...
- Modified
- 31 Oct at 16:33
Disable a Button
Disable a Button I want to disable a button (`UIButton`) on iOS after it is clicked. I am new to developing for iOS but I think the equivalent code on objective - C is this: But I couldn't do that on ...
Convert Dictionary to JSON in Swift
Convert Dictionary to JSON in Swift I have create the next Dictionary: and I get: So, how can I convert it to JSON?
- Modified
- 17 Oct at 11:32
Instance member cannot be used on type
Instance member cannot be used on type I have the following class: Compilation fails with the message: > Instance member 'categoriesPerPage' cannot be used on type 'ReportView' What does this mean?
- Modified
- 17 Dec at 16:58
How to get current language code with Swift?
How to get current language code with Swift? I want get the language code of the device (en, es...) in my app written with Swift. How can get this? I'm trying this: But this returns nil.
Swift days between two NSDates
Swift days between two NSDates I'm wondering if there is some new and awesome possibility to get the amount of days between two NSDates in Swift / the "new" Cocoa? E.g. like in Ruby I would do:
- Modified
- 16 Apr at 09:45
How to change UIButton image in Swift
How to change UIButton image in Swift I am trying to change the image of a UIButton using Swift... What should I do This is OBJ-C code.but I don't know with Swift:
- Modified
- 9 Nov at 07:59
How to append elements into a dictionary in Swift?
How to append elements into a dictionary in Swift? I have a simple Dictionary which is defined like: Now I want to add an element into this dictionary: `3 : "efg"` How can I append `3 : "efg"` into th...
- Modified
- 8 Jul at 15:16
How to detect orientation change?
How to detect orientation change? I am using Swift and I want to be able to load a UIViewController when I rotate to landscape, can anyone point me in the right direction? I Can't find anything online...
- Modified
- 22 Nov at 10:2
Close iOS Keyboard by touching anywhere using Swift
Close iOS Keyboard by touching anywhere using Swift I have been looking all over for this but I can't seem to find it. I know how to dismiss the keyboard using `Objective-C` but I have no idea how to ...
- Modified
- 4 Sep at 16:41
Load a UIView from nib in Swift
Load a UIView from nib in Swift Here is my Objective-C code which I'm using to load a nib for my customised `UIView`: What is the equivalent code in Swift?
Convert string to date in Swift
Convert string to date in Swift How can I convert this string `"2016-04-14T10:44:00+0000"` into an `NSDate` and keep only the year, month, day, hour? The `T` in the middle of it really throws off what...
- Modified
- 29 Dec at 07:48
how to make UITextView height dynamic according to text length?
how to make UITextView height dynamic according to text length? As you can see in this image the `UITextView` changes it's height according to the text length, I want to make it adjust it's height acc...
- Modified
- 2 Aug at 07:51
How do I get the App version and build number using Swift?
How do I get the App version and build number using Swift? I have an IOS app with an Azure back-end, and would like to log certain events, like logins and which versions of the app users are running. ...
Generate a UUID on iOS from Swift
Generate a UUID on iOS from Swift In my iOS Swift app I want to generate random UUID () strings for use as a table key, and this snippet to work: Is this safe? Or is there perhaps a better (recommende...
- Modified
- 25 Apr at 19:40
How to create a global variable?
How to create a global variable? I have a global variable that needs to be shared among my ViewControllers. In Objective-C, I can define a static variable, but I can't find a way to define a global va...
- Modified
- 5 May at 13:51
How to display .svg image using swift
How to display .svg image using swift I have a .svg image file I want to display in my project. I tried using UIImageView, which works for the .png & .jpg image formats, but not for the .svg extension...
NSRange to Range<String.Index>
NSRange to Range How can I convert `NSRange` to `Range` in Swift? I want to use the following `UITextFieldDelegate` method: ![enter im
How to control the line spacing in UILabel
How to control the line spacing in UILabel Is it possible to reduce the gap between text, when put in multiple lines in a `UILabel`? We can set the frame, font size and number of lines. I want to redu...
- Modified
- 28 Apr at 22:0
Changing text of UIButton programmatically swift
Changing text of UIButton programmatically swift Simple question here. I have a UIButton, currencySelector, and I want to programmatically change the text. Here's what I have: Xcode gives me the error...
Get current date in Swift 3?
Get current date in Swift 3? How can I set label.text current date in Swift 3? I want to print just today to the screen. I did not find how to do that. In c# is very simple: I need to write 15.09.2016...
Swift - Remove " character from string
Swift - Remove " character from string I have a string which is `"Optional("5")"`. I need to remove the `""` surrounding the `5`. I have removed the `Optional` by doing: I am having difficulties remov...
How to make a UILabel clickable?
How to make a UILabel clickable? I would like to make a UILabel clickable. I have tried this, but it doesn't work: ``` class DetailViewController: UIViewController { @IBOutlet weak var tripDetails: ...
- Modified
- 8 Jan at 09:37