Skip to content

Commit

Permalink
Merge pull request #6 from TeamHous/feature/#5
Browse files Browse the repository at this point in the history
ADD: add inject(hot reload), and Example code
  • Loading branch information
psychehose authored Jul 4, 2022
2 parents 5de9bc2 + 1a673f6 commit 56e083a
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 44 deletions.
43 changes: 29 additions & 14 deletions HousLab_iOS/HousLab_iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
objects = {

/* Begin PBXBuildFile section */
7713C62B2872F26C00F674BF /* Inject in Frameworks */ = {isa = PBXBuildFile; productRef = 7713C62A2872F26C00F674BF /* Inject */; };
B5B5C11D2872E3DB00FC5134 /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = B5B5C11C2872E3DB00FC5134 /* SnapKit */; };
B5B5C1202872E43E00FC5134 /* Then in Frameworks */ = {isa = PBXBuildFile; productRef = B5B5C11F2872E43E00FC5134 /* Then */; };
B85302A628728F6300F06234 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B85302A528728F6300F06234 /* AppDelegate.swift */; };
B85302A828728F6300F06234 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B85302A728728F6300F06234 /* SceneDelegate.swift */; };
B85302AA28728F6300F06234 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B85302A928728F6300F06234 /* ViewController.swift */; };
B85302AD28728F6300F06234 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B85302AB28728F6300F06234 /* Main.storyboard */; };
B85302AF28728F6400F06234 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B85302AE28728F6400F06234 /* Assets.xcassets */; };
B85302B228728F6400F06234 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B85302B028728F6400F06234 /* LaunchScreen.storyboard */; };
B85302C12872A1EC00F06234 /* HoseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B85302C02872A1EC00F06234 /* HoseViewController.swift */; };
Expand All @@ -26,7 +26,6 @@
B85302A528728F6300F06234 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
B85302A728728F6300F06234 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
B85302A928728F6300F06234 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
B85302AC28728F6300F06234 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
B85302AE28728F6400F06234 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
B85302B128728F6400F06234 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
B85302B328728F6400F06234 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand All @@ -43,6 +42,7 @@
files = (
B5B5C11D2872E3DB00FC5134 /* SnapKit in Frameworks */,
B5B5C1202872E43E00FC5134 /* Then in Frameworks */,
7713C62B2872F26C00F674BF /* Inject in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -134,7 +134,6 @@
isa = PBXGroup;
children = (
B85302A928728F6300F06234 /* ViewController.swift */,
B85302AB28728F6300F06234 /* Main.storyboard */,
);
path = MainViewController;
sourceTree = "<group>";
Expand All @@ -158,6 +157,7 @@
packageProductDependencies = (
B5B5C11C2872E3DB00FC5134 /* SnapKit */,
B5B5C11F2872E43E00FC5134 /* Then */,
7713C62A2872F26C00F674BF /* Inject */,
);
productName = HousLab_iOS;
productReference = B85302A228728F6300F06234 /* HousLab_iOS.app */;
Expand Down Expand Up @@ -190,6 +190,7 @@
packageReferences = (
B5B5C11B2872E3DB00FC5134 /* XCRemoteSwiftPackageReference "SnapKit" */,
B5B5C11E2872E43E00FC5134 /* XCRemoteSwiftPackageReference "Then" */,
7713C6292872F26C00F674BF /* XCRemoteSwiftPackageReference "Inject" */,
);
productRefGroup = B85302A328728F6300F06234 /* Products */;
projectDirPath = "";
Expand All @@ -207,7 +208,6 @@
files = (
B85302B228728F6400F06234 /* LaunchScreen.storyboard in Resources */,
B85302AF28728F6400F06234 /* Assets.xcassets in Resources */,
B85302AD28728F6300F06234 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -231,14 +231,6 @@
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
B85302AB28728F6300F06234 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
B85302AC28728F6300F06234 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
B85302B028728F6400F06234 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
Expand Down Expand Up @@ -305,6 +297,12 @@
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
"-Xlinker",
"-interposable",
"-all_load",
);
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand Down Expand Up @@ -359,6 +357,12 @@
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
"-Xlinker",
"-interposable",
"-all_load",
);
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
Expand All @@ -378,7 +382,6 @@
INFOPLIST_FILE = HousLab_iOS/Supports/Info.plist;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -406,7 +409,6 @@
INFOPLIST_FILE = HousLab_iOS/Supports/Info.plist;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = Main;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -446,6 +448,14 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
7713C6292872F26C00F674BF /* XCRemoteSwiftPackageReference "Inject" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/krzysztofzablocki/Inject.git";
requirement = {
branch = main;
kind = branch;
};
};
B5B5C11B2872E3DB00FC5134 /* XCRemoteSwiftPackageReference "SnapKit" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SnapKit/SnapKit.git";
Expand All @@ -465,6 +475,11 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
7713C62A2872F26C00F674BF /* Inject */ = {
isa = XCSwiftPackageProductDependency;
package = 7713C6292872F26C00F674BF /* XCRemoteSwiftPackageReference "Inject" */;
productName = Inject;
};
B5B5C11C2872E3DB00FC5134 /* SnapKit */ = {
isa = XCSwiftPackageProductDependency;
package = B5B5C11B2872E3DB00FC5134 /* XCRemoteSwiftPackageReference "SnapKit" */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{
"object": {
"pins": [
{
"package": "Inject",
"repositoryURL": "https://github.com/krzysztofzablocki/Inject.git",
"state": {
"branch": "main",
"revision": "81d942634f359dc1d00a904e70328410aefd23fb",
"version": null
}
},
{
"package": "SnapKit",
"repositoryURL": "https://github.com/SnapKit/SnapKit.git",
Expand Down
38 changes: 37 additions & 1 deletion HousLab_iOS/HousLab_iOS/HoSe/HoseViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,40 @@
// Created by 김지현 on 2022/07/04.
//

import Foundation
import UIKit

final class HoseViewController: UIViewController {

private let helloworldLabel: UILabel = {
let label = UILabel()
label.text = "Hello Hous"
label.backgroundColor = .white
label.font = .systemFont(ofSize: 20, weight: .bold)
label.textColor = .black
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()

init() {
super.init(nibName: nil, bundle: nil)
}

required init?(coder: NSCoder) {
super.init(coder: coder)
}

override func viewDidLoad() {
super.viewDidLoad()
setupViews()
}


private func setupViews() {
view.addSubview(helloworldLabel)

NSLayoutConstraint.activate([
helloworldLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor),
helloworldLabel.centerYAnchor.constraint(equalTo: view.centerYAnchor)
])
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
print("Hello Hous")
}


}

2 changes: 0 additions & 2 deletions HousLab_iOS/HousLab_iOS/Supports/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
Expand Down
11 changes: 10 additions & 1 deletion HousLab_iOS/HousLab_iOS/Supports/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import UIKit
import Inject

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

Expand All @@ -16,7 +17,15 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }

guard let windowScene = (scene as? UIWindowScene) else { return }
let window = UIWindow(windowScene: windowScene)
window.backgroundColor = .white
// MARK: - ViewControllerHost에 Hot reload 하고 싶은 ViewController instance를 넣기
window.rootViewController = Inject.ViewControllerHost(HoseViewController())
// window.rootViewController = ViewController()
window.makeKeyAndVisible()
self.window = window
}

func sceneDidDisconnect(_ scene: UIScene) {
Expand Down

0 comments on commit 56e083a

Please sign in to comment.