URL wont open swift 3

@IBAction func download(_ sender: Any) { if let url = URL(string: "\(imgURL)") { UIApplication.shared.openURL(url as URL) } print(imgURL) } The url wont open if i press the button. The consol says the right url: https://scontent...
more »

2017-06-22 20:06 (0) Answers

Display Section Header UICollectionReusableView

I was working on iOS application and I have several problem about using UICollectionView cell. This time, I want to ask about how to display the section header of UICollectionView (UICollectionReusableView) I already implement the function like bel...
more »

2017-06-22 11:06 (3) Answers

Swift: Get 30 days before 'Specific Date'

I have a problem about showing specific date. Here the case, I have a random date from my API (06/16/2015) that always change. I put it into variable name toDate with Date type. I need to get 30 days before the toDate for my fromDate variable. I read...
more »

2017-06-22 04:06 (2) Answers

Change a String that has a link in it

let profile_pic_url_hd = user["profile_pic_url_hd"] as! String self.imgURL = "\(profile_pic_url_hd)" self.imgURL is a link and it is a string. The link is, for example: https://scontent-frx5-1.cdninstagram.com/t51.2885-19/s320x320/19121160_1328742...
more »

2017-06-22 00:06 (1) Answers

Google Analytics nil error xcode swift

func searchBarSearchButtonClicked(_ searchBar: UISearchBar) { let urlRequest = URLRequest(url: URL(string: "https://www.googleapis.com/youtube/v3/channels?part=id&forUsername=\(searchBar.text!.replacingOccurrences(of: " ", with: "%20"))&...
more »

2017-06-21 22:06 (1) Answers

Swift Set Array custom sort

I have Contact model and I want to sort by [firstLetter, fullName] into [section,row] for UITableView in this way "FAVORITES" at startIndex, "#" at endIndex and between them are sorted letters. For example: ["A", "C", "E", "#", "FAVORITES"] into ["FA...
more »

2017-06-21 19:06 (2) Answers

Stretch the last element in UIStackView

I have vertical UIStackView which has two horizontal UIStackViews, if bottom UIStackView has larger width than UIStackView on the top then UIStackView on the top will be stretched to the width of the bottom UIStackView. And now I have first element...
more »

2017-06-21 18:06 (1) Answers

Tab Bar not visible in navigation controller

I created the following Tab Bar Application in xcode. The problem is the tab bar is not visible on the Table View that uses a navigation controller (#2 below). I would like the tabbar to remain visible at #2 below. The Navigation Controller (#1 in ...
more »

2017-06-21 14:06 (1) Answers

How secure is Sinch SDK?

I have implemented sinch SDK in my iOS application and also have a URL callback to check with my backend if the request is from my existing users. But let's say a new user wants to signup to my app and I verify his mobile number, then only sign him ...
more »

2017-06-21 09:06 (0) Answers

Move from one text field to another

How can I make text field-1 move to another text field-2 by Swift when I write two numbers? When I write 22, I want to automatically move to another text field-2. I tried this but it doesn't work: func textField(textField: UITextField, shouldCha...
more »

2017-06-21 06:06 (4) Answers

Swift use value as generic

I could not find a way to use a value in a generic class definition instead of a class or protocol. For instance we often find a number of matrix classes like SCNMatrix3, SCNMatrix4 while it'd be nicer to be able to define a more generic Matrix<a,...
more »

2017-06-20 23:06 (1) Answers

Protocol Extension of Constrained Dictionary

I'm trying to get a specific Dictionary type to conform to a protocol. typealias FirebaseDictionary = Dictionary<String, FirebaseValue> I would like to have the conform to a FirebaseValue protocol protocol FirebaseValue { // stuff here ...
more »

2017-06-20 23:06 (0) Answers

Nested generics in a swift function

Assume I have this bit of code: protocol MyProtocol { } struct MyStruct: MyProtocol { } class MyClass<P: MyProtocol> { // Required for compiling required init() { } } class MySpecialClass: MyClass<MyStruct> { } func foo&l...
more »

2017-06-20 22:06 (2) Answers

Centering label and UITextField inside a TableView

New to xcode/swift, spending a couple of days now trying to fix this one. Creating a universal app and having problems getting the constraint working programmatically. I would like to programmatically add a label and a UITextField inside a TableVie...
more »

2017-06-19 20:06 (2) Answers

Swift 3 - Local Notification at specific data

I need your help for a project. I have 3 variables, one for the day , another for the month and last for the year. Like that : var year = 2017 var month = 06 var day = 19 I want to send a notification even if the app is close when we are at the d...
more »

2017-06-19 16:06 (2) Answers

Open QR link in another ViewController in Xcode

I'm trying to make a QR application but I do not get the last step to work. Today, when I do a scan, I get an alert with the result. I want that link to be sent directly to my webview controller and read the address in my webView instead of showing ...
more »

2017-06-19 15:06 (1) Answers

forced update app with AlertController

I make for my application forced update but when I go back without updating the application AlertController disappears as it can be fixed If you know other options to make a forced update, then write thanks for the help GIF: and Code: func ...
more »

2017-06-19 14:06 (2) Answers

Shortcut for function parameter tooltip

In Swift, when I start using some function, I get a tooltip with description of parameters. But when I start typing, it disappears and I have no idea how to call it after that. What is the shortcut to call this function parameter tool tip again? A...
more »

2017-06-19 12:06 (0) Answers

How to add a button in the TableviewController?

I was wondering how to add a simple static button at the bottom right of the Tableviewcontroller background, its will be contact infos. I have tried through through the storyboard with no success.Do you have any clue for that? Thank you , Regar...
more »

2017-06-19 10:06 (5) Answers

Swift Animate Textfield

I want to create an animation for my UItextfield. To do this, I created a sub class of UITextField and I stored my code there: import Foundation import UIKit class textfieldEdit: UITextField, UITextFieldDelegate { let border = CALayer() ...
more »

2017-06-19 02:06 (1) Answers

Facebook's login opens the wrong app

I'm trying to implement the login of an app with facebook but every time I try to login, it suggests opening the wrong app. I've tried some things I found over here but it didn't work. On facebook's developers page I've added a suffix: And my .p...
more »

2017-06-18 23:06 (0) Answers