Skip to content

Commit

Permalink
finally, set the entrypoint in the info.plist where the main delegate…
Browse files Browse the repository at this point in the history
… is declared
  • Loading branch information
heldrida committed Apr 9, 2020
1 parent 042fc39 commit a220f46
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 32 deletions.
16 changes: 8 additions & 8 deletions EntryPoint.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@

/* Begin PBXBuildFile section */
785AAFB9243F1CB000251254 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 785AAFB8243F1CB000251254 /* AppDelegate.swift */; };
785AAFBB243F1CB000251254 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 785AAFBA243F1CB000251254 /* SceneDelegate.swift */; };
785AAFBB243F1CB000251254 /* SomethingDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 785AAFBA243F1CB000251254 /* SomethingDelegate.swift */; };
785AAFBF243F1CB100251254 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 785AAFBE243F1CB100251254 /* Assets.xcassets */; };
785AAFC2243F1CB100251254 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 785AAFC1243F1CB100251254 /* Preview Assets.xcassets */; };
785AAFC5243F1CB100251254 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 785AAFC3243F1CB100251254 /* LaunchScreen.storyboard */; };
785AAFCD243F1DF500251254 /* somethingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 785AAFCC243F1DF500251254 /* somethingView.swift */; };
785AAFCD243F1DF500251254 /* SomethingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 785AAFCC243F1DF500251254 /* SomethingView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
785AAFB5243F1CB000251254 /* EntryPoint.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EntryPoint.app; sourceTree = BUILT_PRODUCTS_DIR; };
785AAFB8243F1CB000251254 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
785AAFBA243F1CB000251254 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
785AAFBA243F1CB000251254 /* SomethingDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SomethingDelegate.swift; sourceTree = "<group>"; };
785AAFBE243F1CB100251254 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
785AAFC1243F1CB100251254 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
785AAFC4243F1CB100251254 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
785AAFC6243F1CB100251254 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
785AAFCC243F1DF500251254 /* somethingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = somethingView.swift; sourceTree = "<group>"; };
785AAFCC243F1DF500251254 /* SomethingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SomethingView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -57,12 +57,12 @@
isa = PBXGroup;
children = (
785AAFB8243F1CB000251254 /* AppDelegate.swift */,
785AAFBA243F1CB000251254 /* SceneDelegate.swift */,
785AAFBA243F1CB000251254 /* SomethingDelegate.swift */,
785AAFCC243F1DF500251254 /* SomethingView.swift */,
785AAFBE243F1CB100251254 /* Assets.xcassets */,
785AAFC3243F1CB100251254 /* LaunchScreen.storyboard */,
785AAFC6243F1CB100251254 /* Info.plist */,
785AAFC0243F1CB100251254 /* Preview Content */,
785AAFCC243F1DF500251254 /* somethingView.swift */,
);
path = EntryPoint;
sourceTree = "<group>";
Expand Down Expand Up @@ -146,9 +146,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
785AAFCD243F1DF500251254 /* somethingView.swift in Sources */,
785AAFCD243F1DF500251254 /* SomethingView.swift in Sources */,
785AAFB9243F1CB000251254 /* AppDelegate.swift in Sources */,
785AAFBB243F1CB000251254 /* SceneDelegate.swift in Sources */,
785AAFBB243F1CB000251254 /* SomethingDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
2 changes: 1 addition & 1 deletion EntryPoint/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<string>$(PRODUCT_MODULE_NAME).SomethingDelegate</string>
</dict>
</array>
</dict>
Expand Down
16 changes: 0 additions & 16 deletions EntryPoint/SceneDelegate.swift

This file was deleted.

26 changes: 26 additions & 0 deletions EntryPoint/SomethingDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// SceneDelegate.swift
// EntryPoint
//
// Created by Helder Oliveira Correia on 09/04/2020.
// Copyright © 2020 Helder Oliveira. All rights reserved.
//

import UIKit
import SwiftUI

class SomethingDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: SomethingView())
self.window = window
// this is the key window to look at our app through
// xcode knows the sceneDelegate as first, because its definied in the info.plist
// find it in the scene configuration
window.makeKeyAndVisible()
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,3 @@ struct SomethingView_Previews: PreviewProvider {
SomethingView()
}
}

// For example, we can have multiple PreviewProvider structs
struct Whatever: PreviewProvider {
static var previews: some View {
SomethingView()
}
}

0 comments on commit a220f46

Please sign in to comment.