Tag: swift

save current user to relation in parse with swift

I have a system where when the current user accepts a request my app adds a relation between the user that sent the request to the current user. However I want to also have the current user added to the other user’s relation so that it is not just the current user that has a […]

How do you convert optional text input to Int in Swift 2, Xcode 7 beta using if let – toInt does not work

I’m having trouble converting optional input String to Int in order to do calculations on it. let odoField = UITextField() // allows entry of text to iOS field odoField.text = “12500” // simulated input let odoString = odoField.text // now here is where I get trouble… if let odoInt = odoString.toInt() { distance = Double(odoInt) […]

How to swipe right to show new View Controller in Swift 3?

I want to be able to swipe right in my ViewController which will show another view controller, CommunitiesViewController. I have looked on other threads and found some ways of doing this though I believe they are for Swift 2. This is the code I am using in my ViewController: override func viewDidLoad() { super.viewDidLoad() let […]

Create UITextField Extension in Swift with custom styling

I have several UITextFields on the view that have to look the same. I figured out that I might create an Extension that will pre-style my text fields (those that I want to have the same style). let passTextField: UITextField = { let tf = UITextField() //tf.backgroundColor = UIColor.blueColor() tf.translatesAutoresizingMaskIntoConstraints = false tf.layer.cornerRadius = 25 […]

Save Alamofire Result as Variable?

I’ve been trying to find out how to save a part of a JSON response from Alamofire as a variable to make an if statement and can’t seem to find how to do it. I made a piece of code to use as an example for the question which consists of the following: import UIKit […]

How do I create connected text fields in ios?

I want to create a login screen similar to facebook’s for my iOS app. How do I create 2 text-fields that are both in that rounded box?

UINavigationBar frame height returns 44.0 but is actually 64.0

I have a UINavigationController in a storyboard which is not using AutoLayout. With the status bar visible the actual height of the UINavigationBar is 64.0 and yet when I log self.navigationBar.frame.size.height I get 44.0. How do I get the actual height of the UINavigationBar? I’m using Xcode 7.3 and the storyboard builds for iOS 6.

Cannot print the FBSDKAccessToken.currentAccessToken().tokenString in my iOS9 app

I was creating an app in Swift for iOS 9 for learning purposes. I was trying to print the current access Token of Facebook at time when I log into Facebook through my app. When I click the fblogin button it opens Safari and shows me that I already have authorized my app but when […]

Swift – Custom SearchController and SearchBar

I am trying to recreate the search field as seen in the Yahoo Finance app. I followed an online tutorial for customizing the UISearchBar and UISearchController, however I still have some problems. If any of you could open up my project and see where Im going wrong / where I need to add these lines […]

Error 'xcodebuild: Returned an unsuccessful exit code' after trying publishing Pod

Command ‘pod trunk push –verbose’ outputs the following: Build settings from command line: CODE_SIGN_IDENTITY = – SDKROOT = iphonesimulator10.1 === CLEAN TARGET GTNetworkQualityChecker OF PROJECT Pods WITH CONFIGURATION Release === Check dependencies ** INTERNAL ERROR: Uncaught exception ** Uncaught Exception: *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil Stack: 0 __exceptionPreprocess (in CoreFoundation) 1 objc_exception_throw (in […]