swift3

Swift 3 / Xcode 8 Upgrade - 100's of DerivedData files missing from working copy errors

≡放荡痞女 提交于 2019-12-20 08:49:10
问题 I have just upgraded to the latest Beta version of XCode and Swift but after using the converter my app project now has over 200 build time yellow errors all stating /"projectDirectoy"/DerivedData/XXXXXXXXX/XXXX/XXX/xXXX/xXX is missing from working copy... where by the XXXXX's represent various file paths in the DerivedData folder. I have tried deleting the DerivedData folder from the location mentioned in the errors. I have tried deleting everything in the DerivedData folder in ~/Library/. I

Animate cell when pressed using Swift 3

白昼怎懂夜的黑 提交于 2019-12-20 08:39:23
问题 My problem is really simple. I would like to animate a cell within a collectionView. Indeed, I would like to show a grey background behind the cell and scale down the image inside. It would be (almost) the same effect than Pinterest: I used to code that animation on buttons, but I never did that on a cell. How can link a cell to a touchUpInside or TouchDown action for example ? 回答1: If you want to start animation when you touch on the cell, you can implement didHighlightItemAt . You probably

Difficulties converting to Swift 3

二次信任 提交于 2019-12-20 08:30:09
问题 After converting from Swift 2 to Swift 3 (even after converting edit-> convert -> to current swift syntax) I am getting lots of errors. Especially: I am shown total 90 errors for my project which was working fine in Swift 2 before i downloaded this beta Xcode 8.0 and converted to Swift 3 Is this a conversion mistake I am making? 回答1: Most of them are easy fixes, simply by tapping the red button, and having Xcode fix it for you! Others include: CGRect Swift 2: let frame = CGRectMake(0, 0, 20,

Why is data not displayed when viewDidLoad finished in swift? [closed]

廉价感情. 提交于 2019-12-20 08:03:20
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . When my application finished being launched, there are supposed to be data displayed on UITableViewCell. However, there is nothing there, so after relaunch the app, by pressing home button and swiping up the view, and select my demo app, all data is shown up properly and there seems like nothing is wrong. What

Calling delegate function from AppDelegate not working

大憨熊 提交于 2019-12-20 07:39:12
问题 I am trying to call delegate function in AppDelegate, but seems like it never get invoked. import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate,appdelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { if let navigationController = window?.rootViewController, let viewController = navigationController.childViewControllers.first as?

How to play video with cookies content in iOS using AVPlayer in Swift?

二次信任 提交于 2019-12-20 06:48:41
问题 I have used the below implementation to play a video with cookies content from the server, but it shows play icon with cross line. I have refer the link and do following implementation in swift. but I didn't get any output :( func showVideo(url: String) { let videoURL = NSURL(string: url) var cookiesArray = [HTTPCookie]() guard let cookieArray = UserDefaults.standard.array(forKey: Constants.Object.kCookie) as? [[HTTPCookiePropertyKey: Any]] else { return } for cookieProperties in cookieArray

How to insert a override function into a if else statement

故事扮演 提交于 2019-12-20 06:43:35
问题 I realize that with basic logic I cannot put a override function into a if else statement because it will override everything. However i still need to put in the if else statement the prepare for segue. So the way the code I am working works is if a user hits a button twice they win the game and therefore go to the winners view controller where a score is displayed. If they lose they go to a view controller with no score. So I need to put the override function segue in updateTimer() , In the

How to pass values from a Pop Up View Controller to the Previous View Controller?

こ雲淡風輕ζ 提交于 2019-12-20 06:36:53
问题 So In my 1stViewController I have this code: @IBAction func colorDropdown(_ sender: Any) { self.popUpColorPicker() } func popUpColorPicker() { let popOverVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "ColorPicker") as! ColorPicker self.addChildViewController(popOverVC) popOverVC.view.frame = self.view.frame self.view.addSubview(popOverVC.view) popOverVC.didMove(toParentViewController: self) } Which would pop up the 2ndViewController. Upon dismissing

Realm fileExists is always true

谁说胖子不能爱 提交于 2019-12-20 06:33:26
问题 I want to copy preloaded realm file, so I do: Copied my file to project navigator named default.realm . Then check if fileExists: : let bundlePath = Bundle.main.path(forResource: "default", ofType: "realm") let destPath = Realm.Configuration.defaultConfiguration.fileURL?.path let fileManager = FileManager.default if fileManager.fileExists(atPath: destPath!) { //File exist, do nothing print("File exist") } else { do { //Copy file from bundle to Realm default path try fileManager.copyItem

How to solve keyboard problems in Swift 3?

*爱你&永不变心* 提交于 2019-12-20 06:30:22
问题 The problem is that when I try to write in the text fields the keyboard cover them up. How can I scroll the text field up to see what am I writing. I have below lines of code to enable the return key and to hide the keyboard when you touch in a different place: override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { self.view.endEditing(true) }