swift3

Convert matrix_float4x4 to x y z space

痴心易碎 提交于 2019-12-29 18:50:09
问题 I'm using ARKit and trying to get the position of the camera as a rotation and (x,y,z) coordinates in real world space. All I can manage to get is a matrix_float4x4 , which I don't really understand, and euler angles only show the rotation. Here's what I currently have: let transform = sceneView.session.currentFrame?.camera.transform let eulerAngles = sceneView.session.currentFrame?.camera.eulerAngles Here's the output I'm getting: eulerAngles: float3(-0.694798, -0.0866041, -1.68845)

Compile Time Incredibly Slow

十年热恋 提交于 2019-12-29 10:13:49
问题 My project consists of ~350 Swift files and ~40 cocoa pod dependencies. As soon as the entire project was migrated to Swift 3 , build times have been INCREDIBLY slow and took a little over 3 minutes to completely compile. I've noticed that if I rebuild after not changing any files, it builds within a reasonable amount of time. However, if I add a new function, it takes the 3+ minutes. Cocoapods does not seem to be causing the problem as it delays on Compiling Swift source files state. I

How can I make my level menu scrollable vertically?

这一生的挚爱 提交于 2019-12-29 09:57:22
问题 I have the following level Menu (as seen below). I would like to make it vertically scrollable, resulting in a total height double that of the screen (full scroll height). How can I achieve this? Below is the code for the image above: class LevelMenu: SKScene { let levelButtonSize = SKSpriteNode(imageNamed: "b1").size let levelButton1: SKSpriteNode = SKSpriteNode(imageNamed: "b1") let levelButton2: SKSpriteNode = SKSpriteNode(imageNamed: "b2") let levelButton3: SKSpriteNode = SKSpriteNode

Filter Dictionary with a case insensitive search

試著忘記壹切 提交于 2019-12-29 09:21:54
问题 This is a follow-up question on How to Filter a Dictionary only I need the filter to be case-insensitive I have a dictionary that populates a Pickerview in Swift 3. var facilityDict: [Int: [String: String]] = [:] 17: ["id": "199", "facilitycode": "036", "location_name": "Centerpoint Medical Offices"], 41: ["id": "223", "facilitycode": "162", "location_name": "Dark Ridge Medical Center"], 14: ["id": "196", "facilitycode": "023", "location_name": "Spinnerpark"], 20: ["id": "202", "facilitycode"

Error: UICollectionView must be initialized with a non-nil layout parameter

蹲街弑〆低调 提交于 2019-12-29 08:40:08
问题 I am trying to create a Facebook messenger like application from a youtube tutorial. I have a home page where the user click BarButton to open the chats. The Home page works fine, until I click on the BarButton to open the chats, it crashes with the following error message "UICollectionView must be initialized with a non-nil layout parameter". I am new to iOS development so can't really understand what the problem is exactly because I already have the init method. Am I missing something in

Converting Swift 2.3 to Swift 3.0 - Error, Cannot invoke 'dataTask' with an argument list of type'

倾然丶 夕夏残阳落幕 提交于 2019-12-29 08:24:22
问题 I'm trying to convert one of my projects from Swift 2.3 to Swift 3.0 but some reason I get the following error... Cannot invoke 'dataTask' with an argument list of type'(with: NSMutableURLRequest, completionHandler:(Data?, UIRLResponse?, NSError) -> Void)' Overloads for ‘dataTask’ exist with these partially matching parameter lists: (with: URLRequest, completionHandler:@escaping(Data?, URLResponse?, Error?) -> Void), (with: URL, completionHandler: @escaping(Data?, URLResponse?, Error?) ->

Using CFNotificationCallback in Swift, or, @convention(c) blocks in Swift

梦想的初衷 提交于 2019-12-29 08:18:10
问题 I am trying to listen to CoreTelephony notifications using the (now private) CTTelephonyCenterAddObserver C function and CFNotificationCallback callback blocks. My bridging header (to extern the private C functions): #include <CoreFoundation/CoreFoundation.h> #if __cplusplus extern "C" { #endif #pragma mark - API /* This API is a mimic of CFNotificationCenter. */ CFNotificationCenterRef CTTelephonyCenterGetDefault(); void CTTelephonyCenterAddObserver(CFNotificationCenterRef center, const void

Swipe vertical gesture not working with UITableView

孤街醉人 提交于 2019-12-29 08:03:09
问题 I have UIViewController and I have added a UITableView to it in the storyboard, later I added a swipe Up gesture recognizer to the view, but nothing happened. this is my code import UIKit class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UIGestureRecognizerDelegate { @IBOutlet weak var tableview: UITableView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. let swipeRegongnizer =

How to apply filter based on multiple selected rows in UITableView using swift 3

血红的双手。 提交于 2019-12-29 08:02:26
问题 Hello all m having multisectioned tableview design like want to apply filter based on the selected rows in which all the selection is in OR condition except the searchcriteria section(this section is mandatory),now what i want to achieve is want to save all the selection and filter the data when user clicks on Apply button.How to achieve this.Please help. note:i dont want to use any database coz in future i have to post all the selected values using POST method. Code : ViewController.swift

How to detect internet connection with Firebase Database using Swift3?

巧了我就是萌 提交于 2019-12-29 06:25:55
问题 Can any one help me to detect internet connection with Firebase Database using Swift 3? I am using this function to download data from database. func loadData(){ Ref=FIRDatabase.database().reference() Handle = Ref?.child("Posts").queryOrdered(byChild: "Des").queryEqual(toValue: "11").observe(.childAdded ,with: { (snapshot) in if let post = snapshot.value as? [String : AnyObject] { let img = Posts() img.setValuesForKeys(post) self.myarray.append(img) self.tableView.reloadData() }else { } }) }