Tag: ios

(setValue:) Cannot store object of type _SwiftValue at pictureURL. Can only store objects of type NSNumber, NSString, NSDictionary, and NSArray

Having some issues understanding firebase with Swift 3. I’ve remade my observer to look like this: currentUserFirebaseReference.observeSingleEvent(of: .value, with: { (snapshot: FIRDataSnapshot) in let UID = snapshot.key let dict = snapshot.value as! Dictionary<String,AnyObject> let pictureURL = dict[“pictureURL”] as! String I used to just do observation….. in { let picture = snapshot.value![“pictureURL”] But now I guess […]

Swift AVCaptureSession Close Open Button Error : Multiple audio/video AVCaptureInputs are not currently supported

I have a working barcode scanner code. When I click the openCamera button, first time everything is good. When I click the closeCamera button, good, but if I click again the openCamera button gives a fatal error. Code and error are below. In fact, is it possible to toggle camera view with one button? // […]

ScrollView in SpriteKit

I have found a few other questions and answers similar to this, but none of them quite work perfect for me. My vision is to have a horizontal scrollable view at the bottom of the screen where I can scroll through what will look like cards in a hand. Ideally, I could eventually make the […]

Segue Out of Navigation Controller

I am trying to leave the initial view controller, and go into the blank view controller. That is fine, but that would make the blank view controller also part of the navigation controller, which is not what I want. I want to segue out of the view controller. In the view controller I try to […]

How to share iAd banner between views using AppDelegate

I am looking to implement iAd in my app. So far I have managed to get them showing/dismissing correctly in each view using the below. App Delegate: import UIKit import iAd @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? var adBannerView = ADBannerView() View Controller 1: import UIKit import iAd class HomeScreenViewController: UIViewController, UITableViewDelegate, […]

How to save a UIImage to documents directory?

I’m trying to save both a recorded video’s file path, and a thumbnail from the video to the documents directory. Then, set those two values to an object using the file paths so I can use the object to populate a collection view. With the code I have currently (below), after I record a video, […]

UITableView Drag & Drop Outside Table = Crash

The Good My drag & drop function almost works wonderfully. I longPress a cell and it smoothly allows me to move the pressed cell to a new location between two other cells. The table adjusts and the changes save to core data. Great! The Bad My problem is that if I drag the cell below […]

UISearchBar Scope Bar Position?

I am here on an iPad Application and i would like to know if its possible to move the Scope Bar from right to my UISearchBar to another position? I would like to have my Scope Bar under my Search Bar. Is that possible? Thanks in advance.

How to present a ViewController with a UIImagePickerController

I’m attempting to present an ImagePicker, and there after the user has selected an image, present an image editing ViewController where the user can manipulate the image and then send the edited image back to the original ViewController. Question: Is there a standard or best practice approach starting with an initial ViewControlle, then present an […]

Error: Value of type string has no member componentsSeparatedByCharactersInSet

The following code throws the following error: “Value of type string has no member componentsSeparatedByCharactersInSet” This code is from another project that worked before in swift versions 1 or 2 but no longer works. import Foundation extension String { func split() -> [String] { return self.componentsSeparatedByCharactersInSet( CharacterSet.whitespaceAndNewlineCharacterSet()) .filter({$0 != “”}); } } extension Array { […]