swift3

Calling a function which is placed in an Array

痴心易碎 提交于 2019-12-24 18:43:18
问题 I have an array where I have the Title of Button as Key and the Image as Value with position 0. I am calling this in CollectionView and the view looks like show in screenshot. At position 1 i have the name of the function that needs to be called with didSelectItemAt indexPath. How do I execute the function on click? var mainBtnsArr = [ ["Hotels" : ["homepage_hotel", ShowHotelSearch]], ["Flights" : ["homepage_flights", ShowFlightSearch]], ["Transfer" : ["homepage_transfer", ShowTransferSearch]

[_MPWeakInvocationTarget pause]: unrecognized selector sent to instance

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 16:56:04
问题 In PlayerAndLyricsViewController i have added class PlayerAndLyricsViewController: UIViewController{ let commandCenter = MPRemoteCommandCenter.shared() override func viewDidLoad() { commandCenter.nextTrackCommand.addTarget(self, action:#selector(nextPressed)) commandCenter.nextTrackCommand.isEnabled = true } @IBAction func nextPressed(_ sender: Any) { // Some code } } I am using commandCenter to enable and disable for next, back and pause button. When I initialise

[_MPWeakInvocationTarget pause]: unrecognized selector sent to instance

梦想与她 提交于 2019-12-24 16:55:04
问题 In PlayerAndLyricsViewController i have added class PlayerAndLyricsViewController: UIViewController{ let commandCenter = MPRemoteCommandCenter.shared() override func viewDidLoad() { commandCenter.nextTrackCommand.addTarget(self, action:#selector(nextPressed)) commandCenter.nextTrackCommand.isEnabled = true } @IBAction func nextPressed(_ sender: Any) { // Some code } } I am using commandCenter to enable and disable for next, back and pause button. When I initialise

UICollectionView received layout attributes for a cell with an index path that does not exist

只谈情不闲聊 提交于 2019-12-24 12:29:59
问题 I have used two collection views which name is cltnEdits and cltnTools , i am Displaying cltnTools by default. when user click on any item of cltnTools then cltnEdits collection view is appeared otherwise it will be hidden. there is one cancel button with cltnEdits , whenever user click on that cancel button cltnEdits is disappeared(Hidden) and cltnTools is appeared. My both Collection views are in UIStackView I am getting following error while selecting element from collection view which

Swift 3 render textview using NSAttributedString but want change the default font

女生的网名这么多〃 提交于 2019-12-24 12:17:49
问题 First wanna say thank you before if this can be solved..so i have textview that get the data with html tag..so i use attributedText and function to render html..it worked..but i need to change the font family..right now by default it "times new roman" i want to change to "Helvetica" any clue? i use the extension for this : extension Data { var attributedString: NSAttributedString? { do { return try NSAttributedString(data: self, options:[NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType

How to convert form any date format to one date format which is ddMMMMYYYY(10Apr2018)

北战南征 提交于 2019-12-24 12:05:07
问题 I'm getting different types of date formats from google servers. For my convenient i want convert all those date formats into one format. Here is below of different dates i'm getting in response. 17 Jun 14 12:26:20 Tue, 6 Mar 2018 05:16:51 8 Dec 2014 13:41:09 +0000 16 Sep 2014 16:08:47 -0400 29 Oct 2014 20:12:33 +0530 Tue, 8 Jul 2014 11:48:53 -0700 Tue, 03 Jun 2014 08:35:05 GMT Tue, 03 Jun 2014 10:59:00 GMT Wed, 04 Jun 2014 12:26:52 GMT Wed, 7 Mar 2018 17:44:11 +0530 Wed, 07 Mar 2018 11:29:00

Firebase Issues iOS 10.3 on Xcode 8.3 Swift 3 FCM notifications not working

a 夏天 提交于 2019-12-24 11:55:24
问题 I'm working on Xcode 8.3.2 for iOS 10.3.2 with Swift 3 , my project use firebase cloud messaging, when my p12 certificates expired, I updated my certificates p12 to p8 as suggested Firebase's documentation, but the push notifications stopped coming, yesterday when I used the console firebase to test, it was working but today no, the logs print me this as normal: 2017-05-30 10:13:23.932066-0400 lol[5576:1530669] WARNING: Firebase Analytics App Delegate Proxy is disabled. To log deep link

Swift - How to do add an header with parallax effect to tableView

一笑奈何 提交于 2019-12-24 11:02:52
问题 What is the most efficient method for implement an header over a tableView which can animating his frame like in the gif. I need a customizable methods because i would like an header which can became a pageController or similar. Edit: I tried several libraries found on the net and they are different. I need the header remains fixed at the top as in the gif. I tried to modify the examples to accomplish this but had no results. I tried to change the scrollViewdidscroll but I failed because the

How to save the settings in the app when the user changes the notification settings?

梦想的初衷 提交于 2019-12-24 10:45:05
问题 I implemented push notifications in the AppDelegate.swift class in FCM. Notifications is great, but how do I save the settings in the app when the user changes the notifications settings? 回答1: You can check notification settings by calling notification delegate method let notificationCenter = AppDelegate().getNotificationCenter() notificationCenter.getNotificationSettings(completionHandler: { (setting) in if(setting.authorizationStatus == .denied){ }) } Public classes for getting notification

Moya mapper not able to mapObjects from result - Swift 3

人走茶凉 提交于 2019-12-24 10:41:15
问题 Well Hi, I am using moyamapper I've tried different libraries but I am finding the same issue with all of them I am not able to understand where I am going wrong. Now I have a method which get the result in a moya result and Its fine till her here I am using pod 'MoyaModelMapper' func getCategories() { let APIProviderClosure = APIHelper.getAPIProvider() let provider = MoyaProvider<APIType>(endpointClosure:APIProviderClosure, plugins: [NetworkLoggerPlugin(verbose: true)]) provider.request