These are all essential to progressing in your development journey and something I strongly recommend you look into. Integrating the iOS Facebook SDK, to name just a few features, will give your app access to user profiles, provide login with Facebook, and share content on. It sounds to me like you may be misunderstanding the way objects are stored in memory, the way instances of classes and objects work and how the overall lifecycle of objects/classes works. In your example, it would be something like: NewWindowController myWindowController () but of course if your window controller initializer requires any parameters you'd need to supply them too. Vc1.navigationController?.pushViewController(vc2) Instantiate a new window controller of your subclass. let appDelegate as AppDelegate let aVariable appDelegate.someVariable. Checking the docs, it's an optional variable that should be present as long as ist contains the 'UIMainStoryboardFile key' which it does under 'Main'. To review, open the file in an editor that reveals hidden Unicode characters. The AppDelegate does not have a 'window' variable, and provides the error 'Use of unresolved identifier 'window' ' within the didFinishLaunchingWithOptions override. If you’re using a standard navigation stack you could do the following. Xcode 8) Swift 3.x (Introduced with Xcode 8 ). AppDelegate.swift This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. All you’ve done is create a new instance of FirstViewController import OAuthSwift whenever you want to use OAuthSwift. Expand the Target Dependencies group, and add OAuthSwift framework. Select your project and then your app target. This function confirms the delegate of the AppDelegate and present in rootViewController. To say it another way, your FirstViewContriller instance that segues you into vc2 is not the same instance of the class that you’re declaring as vc1 inside vc2. Drag OAuthSwift.xcodeproj to your project in the Project Navigator. To get rootViewController in AppDelegate you should have this below class in AppDeleagate.swift. Remember viewDidLoad is not called as part of init so any data you’re setting there is not actually being set by just initialising a controller. Main issue was how to make it work as the class was a plain Swift class – self.present() could be used inside ViewController, self.window?.rootViewController?.What you’re doing here is initialising your FirstViewController again inside vc2 so the data won’t be set yet unless you do it as part of a custom init. First add a file to create AppDelegate class e.g. Was trying to show an alert dialog in a project’s AppDelegate.swift and ViewController.swift and decided to move it to a function in a separate utility class. The AppDelegate does not have a window variable and provides the error Checking the. The UIApplicationDelegateAdaptor gives the option of using UIApplicationDelegate methods that are traditionally used in UIKit applications.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |