Skip to content

Commit

Permalink
use Inject in local package as well
Browse files Browse the repository at this point in the history
eliminates the previous workaround
in [440fd80] to use a wrapping view

also updating to [email protected]
  • Loading branch information
MarcoEidinger committed Apr 7, 2022
1 parent 125ddc9 commit a744b4c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 31 deletions.
24 changes: 12 additions & 12 deletions DemoApp/DemoApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
objects = {

/* Begin PBXBuildFile section */
8A655DA427FF7FCB00747272 /* Inject in Frameworks */ = {isa = PBXBuildFile; productRef = 8A655DA327FF7FCB00747272 /* Inject */; };
8A69890927FD4B4C00D4BCD3 /* DemoAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A69890827FD4B4C00D4BCD3 /* DemoAppApp.swift */; };
8A69890B27FD4B4C00D4BCD3 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A69890A27FD4B4C00D4BCD3 /* ContentView.swift */; };
8A69890D27FD4B4F00D4BCD3 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8A69890C27FD4B4F00D4BCD3 /* Assets.xcassets */; };
8A69891027FD4B4F00D4BCD3 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8A69890F27FD4B4F00D4BCD3 /* Preview Assets.xcassets */; };
8A69891A27FD4E5000D4BCD3 /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A69891927FD4E5000D4BCD3 /* ViewModel.swift */; };
8A69891C27FD4EC400D4BCD3 /* Home View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A69891B27FD4EC400D4BCD3 /* Home View.swift */; };
8AA241E827FE05BE003C85E2 /* LocalPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 8AA241E727FE05BE003C85E2 /* LocalPackage */; };
8AA2422627FE5B8C003C85E2 /* Inject in Frameworks */ = {isa = PBXBuildFile; productRef = 8AA2422527FE5B8C003C85E2 /* Inject */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -34,7 +34,7 @@
buildActionMask = 2147483647;
files = (
8AA241E827FE05BE003C85E2 /* LocalPackage in Frameworks */,
8AA2422627FE5B8C003C85E2 /* Inject in Frameworks */,
8A655DA427FF7FCB00747272 /* Inject in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -113,7 +113,7 @@
name = DemoApp;
packageProductDependencies = (
8AA241E727FE05BE003C85E2 /* LocalPackage */,
8AA2422527FE5B8C003C85E2 /* Inject */,
8A655DA327FF7FCB00747272 /* Inject */,
);
productName = DemoApp;
productReference = 8A69890527FD4B4C00D4BCD3 /* DemoApp.app */;
Expand Down Expand Up @@ -144,7 +144,7 @@
);
mainGroup = 8A6988FC27FD4B4C00D4BCD3;
packageReferences = (
8AA2422427FE5B8C003C85E2 /* XCRemoteSwiftPackageReference "Inject" */,
8A655DA227FF7FCB00747272 /* XCRemoteSwiftPackageReference "Inject" */,
);
productRefGroup = 8A69890627FD4B4C00D4BCD3 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -384,25 +384,25 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
8AA2422427FE5B8C003C85E2 /* XCRemoteSwiftPackageReference "Inject" */ = {
8A655DA227FF7FCB00747272 /* XCRemoteSwiftPackageReference "Inject" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/krzysztofzablocki/Inject";
repositoryURL = "https://github.com/krzysztofzablocki/Inject.git";
requirement = {
kind = exactVersion;
version = 1.0.3;
version = 1.0.5;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
8AA241E727FE05BE003C85E2 /* LocalPackage */ = {
8A655DA327FF7FCB00747272 /* Inject */ = {
isa = XCSwiftPackageProductDependency;
productName = LocalPackage;
package = 8A655DA227FF7FCB00747272 /* XCRemoteSwiftPackageReference "Inject" */;
productName = Inject;
};
8AA2422527FE5B8C003C85E2 /* Inject */ = {
8AA241E727FE05BE003C85E2 /* LocalPackage */ = {
isa = XCSwiftPackageProductDependency;
package = 8AA2422427FE5B8C003C85E2 /* XCRemoteSwiftPackageReference "Inject" */;
productName = Inject;
productName = LocalPackage;
};
/* End XCSwiftPackageProductDependency section */
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/krzysztofzablocki/Inject.git",
"state" : {
"revision" : "84ebbde86df4ec7532e8bfc6ad1fe4ed2ca1114f",
"version" : "1.0.3"
"revision" : "d8def72472095f3da09c6fcb80e3f4a51188f4ad",
"version" : "1.0.5"
}
}
],
Expand Down
17 changes: 1 addition & 16 deletions DemoApp/DemoApp/Home View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ struct HomeView: View {
ContentView()
.tabItem { Text("Left") }
.tag(1)
RefreshableContent(when: "\(selection)") {
SettingsView()
}
SettingsView()
.tabItem { Text("Right") }
.tag(2)
}
Expand All @@ -26,16 +24,3 @@ struct HomeView_Previews: PreviewProvider {
HomeView()
}
}

struct RefreshableContent<Content: View>: View {
var when: String
var content: Content
init(when changed: String, @ViewBuilder content: () -> Content) {
when = changed
self.content = content()
}

var body: some View {
content
}
}
3 changes: 2 additions & 1 deletion LocalPackage/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/krzysztofzablocki/Inject.git", from: "1.0.5")
],
targets: [
.target(
name: "LocalPackage",
dependencies: []
dependencies: ["Inject"]
),
]
)
4 changes: 4 additions & 0 deletions LocalPackage/Sources/LocalPackage/LocalPackage.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import Inject
import SwiftUI

public struct SettingsView: View {
@ObservedObject private var iO = Inject.observer

public init() {}

public var body: some View {
Expand All @@ -17,6 +20,7 @@ public struct SettingsView: View {
.navigationTitle("Settings")
}
.navigationViewStyle(.stack)
.enableInjection()
}
}

Expand Down

0 comments on commit a744b4c

Please sign in to comment.