swift3

Which event should I use in Landing Page (Home) so that it won't show up when navigating to other VC?

北城余情 提交于 2019-12-13 03:58:04
问题 I have a view controller named HomeVC which acts as a center page to navigate to targeted view controllers based on conditions. HomeVC is the Landing Page or main page. In HomeVC , I have some UIControl s like calendars and others. Problem: The HomeVC shows up a brief second before navigating to VC2 when the condition is met. Requirements: How not to show HomeVC when condition is met when navigating to another UIViewController ? Update: Requirements - not showing the UiControls on HomeVC Here

Could not cast value of type '__NSDictionaryM' (0x1111152b0) to 'FIRDataSnapshot' Firebase Swift 3

偶尔善良 提交于 2019-12-13 03:57:29
问题 I am trying to read nested data structures from Firebase Database, but I don't know how to manage the case when an object of type [String:AnyObject] could be nil. When readFeesCleaner(callback_) is called, it throws an error. func readFeesCleaner(callback: @escaping ((_ feesCleaner: FeesCleaner) -> Void)) { dbRef.child("FeesCleaner").child(self.uidOfTextField!).observeSingleEvent(of: .value, with: { (snapshot: FIRDataSnapshot) in guard !(snapshot.value is NSNull) else { return } //throws

set tableview height dynamically and restrict to some extend swift 3?

我的梦境 提交于 2019-12-13 03:56:47
问题 i have one table view as popUpTableView, in that i need to set table view height as dynamically as per no of rows. i am adding in cellForRowAtIndexpath popupTableView.height = popupTableView.contentSize.height it is working fine but the problem is when no of cells are increasing then the tableview height is increasing than its origingal height extension DiagnosisViewController :UITableViewDataSource { func numberOfSections(in tableView: UITableView) -> Int { return 1 } func tableView(_

How Can I post An Array of Pictures With Following Method Here

ぃ、小莉子 提交于 2019-12-13 03:54:53
问题 I am Using Swift 3 and want to post an Array of pictures with this method - please help how can I do that if let imageData = UIImageJPEGRepresentation(customKindImage.image! , 1) { print("There is Not Any Images to upload!") let uploadScriptUrl = URL(string : "http://www.swiftdeveloperblog.com/http-post-example-script/") var request = URLRequest(url: uploadScriptUrl!) request.httpMethod = "POST" request.setValue("Keep-Alive" , forHTTPHeaderField : "Connection") let task = URLSession.shared

Fetch User Info and append to an Array

我们两清 提交于 2019-12-13 03:53:57
问题 Sorry if this is a very basic question, but I'm looking to fetch a userId from one Firebase table and use that userId to pull data from another Firebase table. In the first function, I call a fetchUserData function to get the firstname of my user based on a given userid. I'm able to pull the firstname, but then how do I return it to my first function so that I can insert it in the append method. func fetchList() { let currentUser = Auth.auth().currentUser! let postRef = self.databaseRef.child

convert files to String then upload them in swift 3?

两盒软妹~` 提交于 2019-12-13 03:47:28
问题 I have a mini file manager in my application that detect files in the app when user copy files to the app with iTunes - file sharing - I used this method to convert the files to String let directoryContents = try FileManager.default.contentsOfDirectory(at: documentsUrl, includingPropertiesForKeys: nil, options: []) print(directoryContents) // if you want to filter the directory contents you can do like this: let pdfFiles = directoryContents.filter{ $0.pathExtension == "pdf" } print("pdf urls:

Find matching elements in array SWIFT 3 [duplicate]

99封情书 提交于 2019-12-13 03:47:12
问题 This question already has answers here : How to get list of common elements of 2 array in Swift? (6 answers) Set operations (union, intersection) on Swift array? (4 answers) Closed 2 years ago . I have two arrays filled with strings and am hoping to identify the matching strings in both arrays. Eg. var ArrayOne = ["Dog", "Cat", "Chicken"] var Array Two = ["Dog", "Elephant", "Chicken", "Sheep"] I am wanting the outcome to be ["Dog", "Chicken"] Thanks in advance 回答1: var ArrayOne = ["Dog", "Cat

LazyFilterBidirectionalCollection<Results<datatype>>' to expected argument type '[datatype]'

让人想犯罪 __ 提交于 2019-12-13 03:46:34
问题 After I convert my project from swift 2.3 to swift 3 , I got this error in Realm Filter I can't get filter result in array : func filterUsers(_ searchText: String, completion: (([Lawyer]) -> Void)) { let bgRealm = try! Realm() // Filter the whole list of users let results = bgRealm.objects(Lawyer.self).filter { (cc) -> Bool in cc.name.contains2(searchText) || cc.name.contains2(searchText) || cc.phoneNumber2.contains2(searchText) } print(results) completion(results) } 回答1: filter , map , etc.

Image Slider with UIScrollView

痴心易碎 提交于 2019-12-13 03:46:30
问题 I am making an image slider that slides automatically every 2 seconds. The code I have wrote moves immediately to the next image without the slide animation, I want to fix it somehow by showing the scrollview scrolling, this is my code: var imagesArray = [UIImage]() static var i = 0 override func viewDidLoad() { super.viewDidLoad() imagesArray = [image1, image2, image3, image4] for i in 0..<imagesArray.count{ let imageview = UIImageView() imageview.image = imagesArray[i] imageview.contentMode

How to get values of an array of dictionary from alamofire response using swift3

淺唱寂寞╮ 提交于 2019-12-13 03:32:08
问题 I'm trying to extract "translations" Array "text" and "verses" array "verse_key" data from below json response using Alamofire and swift3. { "verses": [ { "id": 1, "verse_number": 1, "chapter_id": 1, "verse_key": "1:1", "text_madani": "بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ", "text_indopak": "بِسْمِ اللّٰهِ الرَّحْمٰنِ الرَّحِيْمِ", "text_simple": "بسم الله الرحمن الرحيم", "juz_number": 1, "hizb_number": 1, "rub_number": 1, "sajdah": null, "sajdah_number": null, "page_number": 1, "audio": {