Gewechselt auf SwiftUI

This commit is contained in:
Dr. Julian-Steffen Müller
2019-08-05 14:07:20 +02:00
parent 696525ef6a
commit a45399ce26
29 changed files with 795 additions and 91 deletions

View File

@@ -1 +1 @@
github "dstranz/Disk" "feature/SPM_xcode11"
github "saoudrizwan/Disk"

View File

@@ -21,6 +21,7 @@
B93C1BB02149750E0014FD6E /* AllConsolesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B93C1BAF2149750E0014FD6E /* AllConsolesViewController.swift */; };
B93D60CC22D88F2B00DD390F /* AccessoryDetailController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B93D60CB22D88F2B00DD390F /* AccessoryDetailController.swift */; };
B93D60CE22D88F5700DD390F /* AccessoryDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B93D60CD22D88F5700DD390F /* AccessoryDetailView.swift */; };
B93D60D122E5009700DD390F /* GameViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B93D60D022E5009700DD390F /* GameViewModel.swift */; };
B9418449215422ED0050D099 /* AddEntryPopUpViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9418448215422ED0050D099 /* AddEntryPopUpViewController.swift */; };
B941844B2156891E0050D099 /* UIButtonX.swift in Sources */ = {isa = PBXBuildFile; fileRef = B941844A2156891E0050D099 /* UIButtonX.swift */; };
B94CB4FF22D1352F0029BFAD /* Accessory+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = B94CB4F322D1352F0029BFAD /* Accessory+CoreDataClass.swift */; };
@@ -42,9 +43,17 @@
B98A736022C1738800FB3410 /* CDManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B98A735F22C1738800FB3410 /* CDManager.swift */; };
B9BCF4CA2168ACB600ECBAAC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B9BCF4C92168ACB600ECBAAC /* LaunchScreen.storyboard */; };
B9BCF523217900D700ECBAAC /* WaitingPopOver.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B9BCF521217900D700ECBAAC /* WaitingPopOver.storyboard */; };
B9D2C6F722E98ED800797F67 /* AccessoryViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9D2C6F622E98ED800797F67 /* AccessoryViewModel.swift */; };
B9D6A39A22D885DD00A280DC /* AccessoryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9D6A39922D885DD00A280DC /* AccessoryCell.swift */; };
B9E256FE2156D026009FD133 /* UIViewX.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9E256FD2156D026009FD133 /* UIViewX.swift */; };
B9F002E52187AA3200E12B0A /* FlockeConnector.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9F002E42187AA3200E12B0A /* FlockeConnector.swift */; };
B9F44ABA22F312E600FC6B29 /* ConsoleLibraryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9F44AB922F312E600FC6B29 /* ConsoleLibraryView.swift */; };
B9F44ABC22F3145300FC6B29 /* ConsoleDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9F44ABB22F3145300FC6B29 /* ConsoleDetailViewController.swift */; };
B9F44ABE22F31DEF00FC6B29 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9F44ABD22F31DEF00FC6B29 /* SceneDelegate.swift */; };
B9F44AE322F3216F00FC6B29 /* ConsolesListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9F44AE222F3216F00FC6B29 /* ConsolesListView.swift */; };
B9F44AE522F418F600FC6B29 /* ConsoleStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9F44AE422F418F600FC6B29 /* ConsoleStore.swift */; };
B9F44AE722F429D300FC6B29 /* GameStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9F44AE622F429D300FC6B29 /* GameStore.swift */; };
B9F44AE922F4655600FC6B29 /* AccessoryStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9F44AE822F4655600FC6B29 /* AccessoryStore.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -59,13 +68,12 @@
B926F14921502DE1004D36B7 /* ConsoleEntry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConsoleEntry.swift; sourceTree = "<group>"; };
B93C1B9921496BFD0014FD6E /* Zockerhoehle.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Zockerhoehle.app; sourceTree = BUILT_PRODUCTS_DIR; };
B93C1B9C21496BFD0014FD6E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
B93C1BA121496BFD0014FD6E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
B93C1BA321496BFE0014FD6E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
B93C1BA821496BFE0014FD6E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
B93C1BAE21496CC50014FD6E /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Main.strings; sourceTree = "<group>"; };
B93C1BAF2149750E0014FD6E /* AllConsolesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllConsolesViewController.swift; sourceTree = "<group>"; };
B93D60CB22D88F2B00DD390F /* AccessoryDetailController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessoryDetailController.swift; sourceTree = "<group>"; };
B93D60CD22D88F5700DD390F /* AccessoryDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessoryDetailView.swift; sourceTree = "<group>"; };
B93D60D022E5009700DD390F /* GameViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameViewModel.swift; sourceTree = "<group>"; };
B9418448215422ED0050D099 /* AddEntryPopUpViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddEntryPopUpViewController.swift; sourceTree = "<group>"; };
B941844A2156891E0050D099 /* UIButtonX.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIButtonX.swift; sourceTree = "<group>"; };
B94CB4F322D1352F0029BFAD /* Accessory+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Accessory+CoreDataClass.swift"; sourceTree = "<group>"; };
@@ -85,11 +93,20 @@
B94CB53822D3B6490029BFAD /* GameDetailController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameDetailController.swift; sourceTree = "<group>"; };
B98A731822BA9E4600FB3410 /* Zockerhoehle.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Zockerhoehle.xcdatamodel; sourceTree = "<group>"; };
B98A735F22C1738800FB3410 /* CDManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CDManager.swift; sourceTree = "<group>"; };
B9A054FE22F852B00054D9A0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Zockerhoehle/Base.lproj/WaitingPopOver.storyboard; sourceTree = "<group>"; };
B9A054FF22F852B00054D9A0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
B9BCF4C92168ACB600ECBAAC /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
B9BCF522217900D700ECBAAC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Zockerhoehle/Base.lproj/WaitingPopOver.storyboard; sourceTree = "<group>"; };
B9D2C6F622E98ED800797F67 /* AccessoryViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessoryViewModel.swift; sourceTree = "<group>"; };
B9D6A39922D885DD00A280DC /* AccessoryCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessoryCell.swift; sourceTree = "<group>"; };
B9E256FD2156D026009FD133 /* UIViewX.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewX.swift; sourceTree = "<group>"; };
B9F002E42187AA3200E12B0A /* FlockeConnector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlockeConnector.swift; sourceTree = "<group>"; };
B9F44AB922F312E600FC6B29 /* ConsoleLibraryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConsoleLibraryView.swift; sourceTree = "<group>"; };
B9F44ABB22F3145300FC6B29 /* ConsoleDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConsoleDetailViewController.swift; sourceTree = "<group>"; };
B9F44ABD22F31DEF00FC6B29 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
B9F44AE222F3216F00FC6B29 /* ConsolesListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConsolesListView.swift; sourceTree = "<group>"; };
B9F44AE422F418F600FC6B29 /* ConsoleStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConsoleStore.swift; sourceTree = "<group>"; };
B9F44AE622F429D300FC6B29 /* GameStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameStore.swift; sourceTree = "<group>"; };
B9F44AE822F4655600FC6B29 /* AccessoryStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessoryStore.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -129,6 +146,7 @@
B9418448215422ED0050D099 /* AddEntryPopUpViewController.swift */,
B94CB53822D3B6490029BFAD /* GameDetailController.swift */,
B93D60CB22D88F2B00DD390F /* AccessoryDetailController.swift */,
B9F44ABB22F3145300FC6B29 /* ConsoleDetailViewController.swift */,
);
path = ViewController;
sourceTree = "<group>";
@@ -141,6 +159,8 @@
B94CB53622D3B3CC0029BFAD /* GameDetailView.swift */,
B9D6A39922D885DD00A280DC /* AccessoryCell.swift */,
B93D60CD22D88F5700DD390F /* AccessoryDetailView.swift */,
B9F44AB922F312E600FC6B29 /* ConsoleLibraryView.swift */,
B9F44AE222F3216F00FC6B29 /* ConsolesListView.swift */,
);
path = Views;
sourceTree = "<group>";
@@ -185,6 +205,8 @@
B93C1B9B21496BFD0014FD6E /* Zockerhoehle */ = {
isa = PBXGroup;
children = (
B9F44ABD22F31DEF00FC6B29 /* SceneDelegate.swift */,
B93D60CF22E5006F00DD390F /* ViewModel */,
B98A734622BACA9C00FB3410 /* CDModel */,
B926F14821502D7F004D36B7 /* Lib */,
B926F13A214AF21B004D36B7 /* Utils */,
@@ -203,6 +225,18 @@
path = Zockerhoehle;
sourceTree = "<group>";
};
B93D60CF22E5006F00DD390F /* ViewModel */ = {
isa = PBXGroup;
children = (
B93D60D022E5009700DD390F /* GameViewModel.swift */,
B9D2C6F622E98ED800797F67 /* AccessoryViewModel.swift */,
B9F44AE422F418F600FC6B29 /* ConsoleStore.swift */,
B9F44AE622F429D300FC6B29 /* GameStore.swift */,
B9F44AE822F4655600FC6B29 /* AccessoryStore.swift */,
);
path = ViewModel;
sourceTree = "<group>";
};
B98A734622BACA9C00FB3410 /* CDModel */ = {
isa = PBXGroup;
children = (
@@ -266,7 +300,6 @@
knownRegions = (
en,
Base,
de,
);
mainGroup = B93C1B9021496BFD0014FD6E;
productRefGroup = B93C1B9A21496BFD0014FD6E /* Products */;
@@ -325,14 +358,19 @@
B94CB53722D3B3CC0029BFAD /* GameDetailView.swift in Sources */,
B94CB50322D1352F0029BFAD /* Game+CoreDataClass.swift in Sources */,
B94CB50822D1352F0029BFAD /* GameSeries+CoreDataProperties.swift in Sources */,
B9F44ABA22F312E600FC6B29 /* ConsoleLibraryView.swift in Sources */,
B9F44ABE22F31DEF00FC6B29 /* SceneDelegate.swift in Sources */,
B9D2C6F722E98ED800797F67 /* AccessoryViewModel.swift in Sources */,
B93C1BB02149750E0014FD6E /* AllConsolesViewController.swift in Sources */,
B926F13F214E4678004D36B7 /* GameCell.swift in Sources */,
B9F002E52187AA3200E12B0A /* FlockeConnector.swift in Sources */,
B94CB50A22D1352F0029BFAD /* Logo+CoreDataProperties.swift in Sources */,
B94CB4FF22D1352F0029BFAD /* Accessory+CoreDataClass.swift in Sources */,
B98A734D22BAD27D00FB3410 /* Zockerhoehle.xcdatamodeld in Sources */,
B93D60D122E5009700DD390F /* GameViewModel.swift in Sources */,
B9E256FE2156D026009FD133 /* UIViewX.swift in Sources */,
B926F12B2149B173004D36B7 /* ConsoleCell.swift in Sources */,
B9F44AE722F429D300FC6B29 /* GameStore.swift in Sources */,
B926F12D2149B264004D36B7 /* FlockeEntry.swift in Sources */,
B98A735E22BFAA4B00FB3410 /* ConsoleLibraryViewController.swift in Sources */,
B94CB50522D1352F0029BFAD /* Console+CoreDataClass.swift in Sources */,
@@ -344,14 +382,18 @@
B926F14A21502DE1004D36B7 /* ConsoleEntry.swift in Sources */,
B93D60CC22D88F2B00DD390F /* AccessoryDetailController.swift in Sources */,
B94CB50722D1352F0029BFAD /* GameSeries+CoreDataClass.swift in Sources */,
B9F44ABC22F3145300FC6B29 /* ConsoleDetailViewController.swift in Sources */,
B9418449215422ED0050D099 /* AddEntryPopUpViewController.swift in Sources */,
B94CB50022D1352F0029BFAD /* Accessory+CoreDataProperties.swift in Sources */,
B9D6A39A22D885DD00A280DC /* AccessoryCell.swift in Sources */,
B926F14721502D53004D36B7 /* CodableExtensionAny.swift in Sources */,
B94CB50422D1352F0029BFAD /* Game+CoreDataProperties.swift in Sources */,
B9F44AE922F4655600FC6B29 /* AccessoryStore.swift in Sources */,
B98A736022C1738800FB3410 /* CDManager.swift in Sources */,
B94CB50222D1352F0029BFAD /* Cover+CoreDataProperties.swift in Sources */,
B9F44AE322F3216F00FC6B29 /* ConsolesListView.swift in Sources */,
B94CB50122D1352F0029BFAD /* Cover+CoreDataClass.swift in Sources */,
B9F44AE522F418F600FC6B29 /* ConsoleStore.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -361,8 +403,7 @@
B93C1BA021496BFD0014FD6E /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
B93C1BA121496BFD0014FD6E /* Base */,
B93C1BAE21496CC50014FD6E /* de */,
B9A054FF22F852B00054D9A0 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
@@ -370,7 +411,7 @@
B9BCF521217900D700ECBAAC /* WaitingPopOver.storyboard */ = {
isa = PBXVariantGroup;
children = (
B9BCF522217900D700ECBAAC /* Base */,
B9A054FE22F852B00054D9A0 /* Base */,
);
name = WaitingPopOver.storyboard;
sourceTree = "<group>";
@@ -498,6 +539,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = M9N7K3KZX9;
FRAMEWORK_SEARCH_PATHS = (
@@ -511,6 +554,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "de.mm-neuemedien.Zockerhoehle";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
@@ -520,6 +564,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = M9N7K3KZX9;
FRAMEWORK_SEARCH_PATHS = (
@@ -533,6 +579,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "de.mm-neuemedien.Zockerhoehle";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};

View File

@@ -23,30 +23,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
#endif
print("disFinishLaunchung")
FlockeWS.fetchEntries(for: GameCollection.consoleID)
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}

View File

@@ -27,7 +27,7 @@
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Pz7-pW-H47" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1092" y="163"/>
<point key="canvasLocation" x="-1630" y="163"/>
</scene>
<!--Zockerhöhle-->
<scene sceneID="tne-QT-ifu">
@@ -112,7 +112,7 @@
<outlet property="consoleName" destination="STD-i3-2rX" id="63C-WU-8Hh"/>
<outlet property="gamesCounter" destination="i4R-Q2-6HF" id="AIt-Wn-fJE"/>
<outlet property="logo" destination="eMj-mQ-9P0" id="h3L-8f-kid"/>
<segue destination="gOk-ki-5XF" kind="show" identifier="consoleDetail" id="ssy-HC-GiZ"/>
<segue destination="FR4-qM-V1O" kind="show" id="z9f-xb-aJH"/>
</connections>
</tableViewCell>
</prototypes>
@@ -141,7 +141,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-95.200000000000003" y="162.5615763546798"/>
<point key="canvasLocation" x="-852" y="163"/>
</scene>
<!--Console Items-->
<scene sceneID="vbP-hc-pyH">
@@ -152,7 +152,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="t1f-CJ-SKt">
<rect key="frame" x="30" y="98" width="354" height="32"/>
<rect key="frame" x="30" y="54" width="354" height="32"/>
<segments>
<segment title="Spiele"/>
<segment title="Zubehör"/>
@@ -162,7 +162,7 @@
</connections>
</segmentedControl>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="QOr-lL-yeW">
<rect key="frame" x="0.0" y="139" width="414" height="723"/>
<rect key="frame" x="0.0" y="95" width="414" height="767"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="accessoryCell" rowHeight="45" id="t0G-BL-TO2" userLabel="accessoryCell" customClass="AccessoryCell" customModule="Zockerhoehle" customModuleProvider="target">
@@ -235,16 +235,16 @@
</view>
<navigationItem key="navigationItem" title="ConsoleItems" id="cjW-0L-Q8w">
<rightBarButtonItems>
<barButtonItem systemItem="organize" id="3Mh-Er-qnk">
<connections>
<action selector="toggleWishlist:" destination="gOk-ki-5XF" id="S2Q-tK-h9b"/>
</connections>
</barButtonItem>
<barButtonItem systemItem="compose" id="apo-qe-Xtq">
<barButtonItem image="plus" catalog="system" id="apo-qe-Xtq">
<connections>
<segue destination="mMA-rS-Z54" kind="presentation" identifier="consoleEntryAdd" id="R0Q-dU-JyP"/>
</connections>
</barButtonItem>
<barButtonItem title="Wishlist" image="star" catalog="system" style="plain" id="3Mh-Er-qnk">
<connections>
<action selector="toggleWishlist:" destination="gOk-ki-5XF" id="S2Q-tK-h9b"/>
</connections>
</barButtonItem>
</rightBarButtonItems>
</navigationItem>
<connections>
@@ -255,7 +255,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="VXK-q6-aSh" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="581" y="162"/>
<point key="canvasLocation" x="-142" y="163"/>
</scene>
<!--Add Entry Pop Up View Controller-->
<scene sceneID="Zw3-Mn-1MA">
@@ -410,7 +410,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="DA6-P7-KUh" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1920.289855072464" y="162.72321428571428"/>
<point key="canvasLocation" x="770" y="414"/>
</scene>
<!--Hosting Controller-->
<scene sceneID="0Pa-u4-vNw">
@@ -422,18 +422,18 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
</containerView>
</objects>
<point key="canvasLocation" x="2199" y="-526"/>
<point key="canvasLocation" x="1629" y="-265"/>
</scene>
<!--Game Detail Controller-->
<scene sceneID="HBi-xr-Jcc">
<objects>
<viewController id="R5k-Vz-d3r" customClass="GameDetailController" customModule="Zockerhoehle" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="HUF-dg-EL5">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="842"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nBd-hQ-o3p">
<rect key="frame" x="0.0" y="88" width="414" height="774"/>
<rect key="frame" x="0.0" y="44" width="414" height="798"/>
<connections>
<segue destination="hrQ-Ux-Noc" kind="embed" destinationCreationSelector="embedConsoleDetail:" id="XfG-VE-2Zn"/>
</connections>
@@ -451,18 +451,18 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="8KX-Py-CBC" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1272" y="-599"/>
<point key="canvasLocation" x="772" y="-265"/>
</scene>
<!--Accessory Detail Controller-->
<scene sceneID="6M3-J4-bBk">
<objects>
<viewController id="DhC-ew-LGX" customClass="AccessoryDetailController" customModule="Zockerhoehle" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="05c-6e-wjg">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="842"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HaX-Qb-L8E">
<rect key="frame" x="0.0" y="88" width="414" height="774"/>
<rect key="frame" x="0.0" y="44" width="414" height="798"/>
<connections>
<segue destination="IHD-CO-X7J" kind="embed" destinationCreationSelector="emebdedAccessoryDetaio:" id="o2V-GB-pPU"/>
</connections>
@@ -480,7 +480,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="DoD-SM-DFW" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-287" y="-644"/>
<point key="canvasLocation" x="771" y="-944"/>
</scene>
<!--Hosting Controller-->
<scene sceneID="89e-4g-MS7">
@@ -488,8 +488,49 @@
<hostingController id="IHD-CO-X7J" sceneMemberID="viewController"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="NbQ-0I-7vv" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="493" y="-1000"/>
<point key="canvasLocation" x="1629" y="-944"/>
</scene>
<!--Hosting Controller-->
<scene sceneID="uXI-rk-u7z">
<objects>
<hostingController id="rGO-bP-YXz" sceneMemberID="viewController"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="OYQ-LS-mGK" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-52" y="-526"/>
</scene>
<!--Console Detail View Controller-->
<scene sceneID="zNL-KP-pEp">
<objects>
<viewController id="FR4-qM-V1O" customClass="ConsoleDetailViewController" customModule="Zockerhoehle" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Zxk-Yp-aus">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Rk2-xB-bBv">
<rect key="frame" x="0.0" y="88" width="414" height="774"/>
<connections>
<segue destination="rGO-bP-YXz" kind="embed" destinationCreationSelector="embedConsoleDetail:" id="VOL-Vn-VOO"/>
</connections>
</containerView>
</subviews>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="Rk2-xB-bBv" firstAttribute="leading" secondItem="z7u-71-0qP" secondAttribute="leading" id="0r5-8A-ofH"/>
<constraint firstItem="Rk2-xB-bBv" firstAttribute="top" secondItem="z7u-71-0qP" secondAttribute="top" id="Vft-9n-1mo"/>
<constraint firstItem="z7u-71-0qP" firstAttribute="trailing" secondItem="Rk2-xB-bBv" secondAttribute="trailing" id="WFO-rv-wuZ"/>
<constraint firstItem="z7u-71-0qP" firstAttribute="bottom" secondItem="Rk2-xB-bBv" secondAttribute="bottom" id="sQg-Ez-x2h"/>
</constraints>
<viewLayoutGuide key="safeArea" id="z7u-71-0qP"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Udm-xB-cee" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-1007" y="-526"/>
</scene>
</scenes>
<resources>
<image name="plus" catalog="system" width="64" height="58"/>
<image name="star" catalog="system" width="64" height="58"/>
</resources>
<color key="tintColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</document>

View File

@@ -11,6 +11,10 @@ import Foundation
import CoreData
@objc(Accessory)
public class Accessory: NSManagedObject {
public class Accessory: NSManagedObject, Identifiable {
@nonobjc public class func fetchRequest(console : Console) -> NSFetchRequest<Accessory> {
let fetchRequest = NSFetchRequest<Accessory>(entityName: "Accessory")
fetchRequest.predicate = NSPredicate(format: "console == %@", console)
return fetchRequest
}
}

View File

@@ -9,7 +9,7 @@
import Foundation
import CoreData
import UIKit
extension Accessory {

View File

@@ -11,6 +11,12 @@ import Foundation
import CoreData
@objc(Console)
public class Console: NSManagedObject {
public class Console: NSManagedObject, Identifiable {
public var id : NSManagedObjectID {
get {
return self.objectID
}
}
}

View File

@@ -19,7 +19,7 @@ extension Console {
@NSManaged public var generation: Int64
@NSManaged public var manufacturer: String?
@NSManaged public var name: String?
@NSManaged public var name: String
@NSManaged public var accessories: NSSet
@NSManaged public var games: NSSet
@NSManaged public var logo: Logo?

View File

@@ -9,8 +9,14 @@
import Foundation
import CoreData
import SwiftUI
@objc(Game)
public class Game: NSManagedObject {
public class Game: NSManagedObject, Identifiable {
@nonobjc public class func fetchRequest(console : Console) -> NSFetchRequest<Game> {
let fetchRequest = NSFetchRequest<Game>(entityName: "Game")
fetchRequest.predicate = NSPredicate(format: "console == %@", console)
return fetchRequest
}
}

View File

@@ -17,7 +17,7 @@ extension Game {
return NSFetchRequest<Game>(entityName: "Game")
}
@NSManaged public var finished: Date?
@NSManaged public var isFinished: Bool
@NSManaged public var inWishlist: Bool
@NSManaged public var isDigital: Bool
@NSManaged public var name: String

View File

@@ -27,10 +27,27 @@
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
</dict>
</array>
</dict>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>

View File

@@ -41,10 +41,15 @@ class GameCollection {
let cdm = CDManager.shared
var tmpConsole : Console? = .none
for console in self.consoles {
let cdConsole = Console(entity: Console.entity(), insertInto: cdm.viewContext)
cdConsole.name = console.name
if cdConsole.name == "Nintendo Entertainment System" {
tmpConsole = cdConsole
}
cdConsole.generation = Int64(console.generation ?? 0)
cdConsole.manufacturer = console.manufacturer
@@ -78,6 +83,22 @@ class GameCollection {
}
}
guard let con = tmpConsole else {
print("No Console")
return
}
let fetchReq = NSFetchRequest<Game>(entityName: "Game")
fetchReq.predicate = NSPredicate(format: "console=%@", con)
do {
let fetchRes = try CDManager.shared.viewContext.fetch(fetchReq)
for g in fetchRes {
print("\(g.name)")
}
}catch {
print(error)
}
}catch let error as NSError {
print("Load of Chached not possible \(error.localizedDescription)");
}

View File

@@ -0,0 +1,63 @@
//
// SceneDelegate.swift
// Zockerhoehle
//
// Created by Julian-Steffen Müller on 01.08.19.
// Copyright © 2019 Julian-Steffen Müller. All rights reserved.
//
import Foundation
import UIKit
import SwiftUI
class SceneDelegate: UIResponder, UIWindowSceneDelegate, UIApplicationDelegate {
var window: UIWindow?
let gameStore = GameStore(console: .none)
let consoleStore = ConsoleStore()
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// 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).
// Use a UIHostingController as window root view controller
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
let view = ConsolesListView(gameStore: self.gameStore)
window.rootViewController = UIHostingController(rootView: view)
self.window = window
window.makeKeyAndVisible()
}
}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
// Release any resources associated with this scene that can be re-created the next time the scene connects.
// The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
}
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
}
func sceneWillEnterForeground(_ scene: UIScene) {
// Called as the scene transitions from the background to the foreground.
// Use this method to undo the changes made on entering the background.
}
func sceneDidEnterBackground(_ scene: UIScene) {
// Called as the scene transitions from the foreground to the background.
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
// Save changes in the application's managed object context when the application transitions to the background.
}
}

View File

@@ -32,9 +32,18 @@ class FlockeWS {
DispatchQueue.main.async {
GameCollection.shared.updateGameItems(items: consoles, with: parent)
for console in consoles {
FlockeWS.fetchEntries(for: console.id)
if let att = console.iconAttachment {
FlockeWS.fetchAttachment(attachment: att.id)
}
}
}
}else{
print("FLOCKEWS::fetchEntries; \(err?.localizedDescription ?? "N/A")")
}
}
task.resume()
}

View File

@@ -15,6 +15,7 @@ class AccessoryDetailController : UIViewController {
@IBSegueAction func emebdedAccessoryDetaio(_ coder: NSCoder) -> UIViewController? {
return UIHostingController(coder: coder, rootView: AccessoryDetailView(accessory: accessory))
let accessoryVM = AccessoryViewModel(accessory: accessory!)
return UIHostingController(coder: coder, rootView: AccessoryDetailView(accessoryVM: accessoryVM))
}
}

View File

@@ -0,0 +1,17 @@
//
// ConsoleDetailViewController.swift
// Zockerhoehle
//
// Created by Julian-Steffen Müller on 01.08.19.
// Copyright © 2019 Julian-Steffen Müller. All rights reserved.
//
import Foundation
import UIKit
import SwiftUI
class ConsoleDetailViewController : UIViewController {
@IBSegueAction func embedConsoleDetail(_ coder: NSCoder) -> UIViewController? {
return UIHostingController(coder: coder, rootView: ConsoleLibraryView(console: .none))
}
}

View File

@@ -27,9 +27,9 @@ class ConsoleLibraryViewController: UIViewController {
//Remove subscription to old console object
subsriber?.cancel()
subsriber = console?.publisher(for: \.games, options: .new).sink(receiveValue: {_ in
self.refreshConsoleLibrary()
})
//subsriber = console?.publisher(for: \.games, options: .new).sink(receiveValue: {_ in
// self.refreshConsoleLibrary()
//})
refreshConsoleLibrary()
}

View File

@@ -15,6 +15,11 @@ class GameDetailController : UIViewController {
@IBSegueAction func embedConsoleDetail(_ coder: NSCoder) -> UIViewController? {
return UIHostingController(coder: coder, rootView: GameDetailView(game: game))
guard let game = self.game else {
print("ERROR GameDetailController::emedConsoleDetail; Game optional is empty")
return UIViewController()
}
return UIHostingController(coder: coder, rootView: GameDetailView(gameVM: GameViewModel(game: game)) )
}
}

View File

@@ -0,0 +1,56 @@
//
// AccessoryStore.swift
// Zockerhoehle
//
// Created by Julian-Steffen Müller on 02.08.19.
// Copyright © 2019 Julian-Steffen Müller. All rights reserved.
//
import Foundation
import SwiftUI
import CoreData
import Combine
class AccessoryStore : NSObject, ObservableObject, NSFetchedResultsControllerDelegate {
var objectWillChange = ObservableObjectPublisher()
var consoleFilter : Console?
var accessories : [Accessory] {
get {
if self.fetchResultsController.fetchedObjects == nil {
do {
try fetchResultsController.performFetch()
}catch {
print("AccessoryStore::accessories Perform Fetch not possible '\(error)'")
}
}
return self.fetchResultsController.fetchedObjects ?? []
}
}
lazy var fetchResultsController : NSFetchedResultsController<Accessory> = {
var accessoriesFetch : NSFetchRequest<Accessory> = Accessory.fetchRequest()
if let console = consoleFilter {
accessoriesFetch = Accessory.fetchRequest(console: console)
}
accessoriesFetch.sortDescriptors = [NSSortDescriptor(key: "name", ascending: true)]
let accessoriesFetchRC = NSFetchedResultsController(fetchRequest: accessoriesFetch, managedObjectContext: CDManager.shared.viewContext, sectionNameKeyPath: nil, cacheName: nil)
accessoriesFetchRC.delegate = self
return accessoriesFetchRC
}()
init(console : Console?) {
super.init()
self.consoleFilter = console
}
func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
print("GameStore::controllerDidChangeContent")
self.objectWillChange.send()
}
}

View File

@@ -0,0 +1,76 @@
//
// AccessoryViewModel.swift
// Zockerhoehle
//
// Created by Julian-Steffen Müller on 25.07.19.
// Copyright © 2019 Julian-Steffen Müller. All rights reserved.
//
import Foundation
import UIKit
import Combine
import SwiftUI
class AccessoryViewModel : ObservableObject {
var objectWillChange = ObservableObjectPublisher()
var inWishlist : Bool {
didSet {
if let accessory = self.accessory {
accessory.inWishlist = inWishlist
}
}
}
var manufacturer : String? {
didSet {
if let accessory = self.accessory {
accessory.manufacturer = manufacturer
}
}
}
var color : String? {
didSet {
if let accessory = self.accessory {
accessory.color = color
}
}
}
var name : String {
didSet {
if let accessory = self.accessory {
accessory.name = name
}
}
}
private var accessory : Accessory? {
didSet {
if accessory != nil {
self.name = accessory!.name
self.inWishlist = accessory!.inWishlist
self.color = accessory!.color
self.manufacturer = accessory!.manufacturer
}
}
}
init(accessory : Accessory) {
self.accessory = accessory
self.name = accessory.name
self.inWishlist = accessory.inWishlist
self.color = accessory.color
self.manufacturer = accessory.manufacturer
_ = NotificationCenter.default.publisher(for: .NSManagedObjectContextObjectsDidChange, object: CDManager.shared.viewContext).sink {
//TODO
self.objectWillChange.send()
if let accessory = self.accessory {
print("Accessory: \(accessory.name) Notification: \($0.description)")
}
}
}
}

View File

@@ -0,0 +1,48 @@
//
// ConsoleStore.swift
// Zockerhoehle
//
// Created by Julian-Steffen Müller on 02.08.19.
// Copyright © 2019 Julian-Steffen Müller. All rights reserved.
//
import Foundation
import Combine
import SwiftUI
import CoreData
class ConsoleStore : NSObject, ObservableObject, NSFetchedResultsControllerDelegate {
var objectWillChange = ObservableObjectPublisher()
var consoles : [Console] {
get {
if self.fetchResultsController.fetchedObjects == nil {
do {
try fetchResultsController.performFetch()
}catch {
print("ConsoleStore::consoles Perform Fetch not possible '\(error)'")
}
}
return self.fetchResultsController.fetchedObjects ?? []
}
}
lazy var fetchResultsController : NSFetchedResultsController<Console> = {
let consolesFetch : NSFetchRequest<Console> = Console.fetchRequest()
consolesFetch.sortDescriptors = [NSSortDescriptor(key: "manufacturer", ascending: true), NSSortDescriptor(key: "generation", ascending: true), NSSortDescriptor(key: "name", ascending: true)]
var consolesfetchRC = NSFetchedResultsController(fetchRequest: consolesFetch, managedObjectContext: CDManager.shared.viewContext, sectionNameKeyPath: nil, cacheName: nil)
consolesfetchRC.delegate = self
return consolesfetchRC
}()
func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
print("AllConsolesViewController::controllerDidChangeContent")
self.objectWillChange.send()
}
}

View File

@@ -0,0 +1,56 @@
//
// GameStore.swift
// Zockerhoehle
//
// Created by Julian-Steffen Müller on 02.08.19.
// Copyright © 2019 Julian-Steffen Müller. All rights reserved.
//
import Foundation
import SwiftUI
import CoreData
import Combine
class GameStore : NSObject, ObservableObject, NSFetchedResultsControllerDelegate {
var objectWillChange = PassthroughSubject<Void , Never>()
var consoleFilter : Console?
var games : [Game] {
get {
if self.fetchResultsController.fetchedObjects == nil {
do {
try fetchResultsController.performFetch()
}catch {
print("GameStore::games Perform Fetch not possible '\(error)'")
}
}
return self.fetchResultsController.fetchedObjects ?? []
}
}
lazy var fetchResultsController : NSFetchedResultsController<Game> = {
var gamesFetch : NSFetchRequest<Game> = Game.fetchRequest()
if let console = consoleFilter {
gamesFetch = Game.fetchRequest(console: console)
}
gamesFetch.sortDescriptors = [NSSortDescriptor(key: "name", ascending: true)]
let gamesFetchRC = NSFetchedResultsController(fetchRequest: gamesFetch, managedObjectContext: CDManager.shared.viewContext, sectionNameKeyPath: nil, cacheName: nil)
gamesFetchRC.delegate = self
return gamesFetchRC
}()
init(console : Console?) {
super.init()
self.consoleFilter = console
}
func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
print("GameStore::controllerDidChangeContent")
self.objectWillChange.send()
}
}

View File

@@ -0,0 +1,77 @@
//
// GameViewModel.swift
// Zockerhoehle
//
// Created by Julian-Steffen Müller on 21.07.19.
// Copyright © 2019 Julian-Steffen Müller. All rights reserved.
//
import Foundation
import SwiftUI
import Combine
import CoreData
import UIKit
class GameViewModel : ObservableObject {
var objectWillChange = ObservableObjectPublisher()
private var game : Game? {
didSet {
if game != nil {
self.name = game!.name
self.inWishlist = game!.inWishlist
self.isDigital = game!.isDigital
self.isFinished = game!.isFinished
}
}
}
var name : String {
didSet {
if let game = self.game {
game.name = name
}
}
}
var inWishlist : Bool {
didSet {
if let game = self.game {
game.inWishlist = inWishlist
}
}
}
var isDigital : Bool {
didSet {
if let game = self.game {
game.isDigital = isDigital
}
}
}
var isFinished : Bool {
didSet {
if let game = self.game {
game.isFinished = isFinished
}
}
}
init(game : Game) {
self.game = game
self.name = game.name
self.inWishlist = game.inWishlist
self.isDigital = game.isDigital
self.isFinished = game.isFinished
_ = NotificationCenter.default.publisher(for: .NSManagedObjectContextObjectsDidChange, object: CDManager.shared.viewContext).sink {
//TODO
self.objectWillChange.send()
if let game = self.game {
print("Game: \(game.name) Notification: \($0.description)")
}
}
}
}

View File

@@ -11,19 +11,28 @@ import SwiftUI
struct AccessoryDetailView : View {
var accessory : Accessory?
@ObservedObject var accessoryVM : AccessoryViewModel
var body: some View {
Text(accessory?.name ?? "N/A").color(Color.red)
Form {
TextField("Accessory name", text: $accessoryVM.name)
Toggle(isOn: $accessoryVM.inWishlist, label: {
Text("In Wunschliste")
})
}.navigationBarTitle(Text("\(accessoryVM.name)"), displayMode: .automatic)
}
init(accessory : Accessory?) {
self.accessory = accessory
init(accessoryVM : AccessoryViewModel?) {
self.accessoryVM = accessoryVM!
}
}
#if DEBUG
struct AccessoryDetailView_Previews : PreviewProvider {
static var previews: some View {
AccessoryDetailView(accessory: nil)
AccessoryDetailView(accessoryVM: nil)
}
}
#endif

View File

@@ -0,0 +1,94 @@
//
// ConsoleLibraryView.swift
// Zockerhoehle
//
// Created by Julian-Steffen Müller on 01.08.19.
// Copyright © 2019 Julian-Steffen Müller. All rights reserved.
//
import SwiftUI
struct ConsoleLibraryView : View {
@State var isVideogamesSelected = true
var console : Console?
@ObservedObject var gameStore : GameStore
@ObservedObject var accessoryStore : AccessoryStore
@State var showWishlist = false
@State var isModal: Bool = false
var modal: some View {
NavigationView {
Form {
Text("bl")
}
.font(.caption)
.navigationBarTitle(self.isVideogamesSelected ? Text("New Game") : Text("New Accessory"))
.navigationBarItems(trailing: Button(action: { self.isModal = false } ) { Text("Done") })
}
}
var body: some View {
VStack {
HStack {
Spacer()
Picker("Options", selection: $isVideogamesSelected) {
Text("Videogames").tag(true)
Text("Accessories").tag(false)
}.pickerStyle(SegmentedPickerStyle())
Spacer()
}
if self.isVideogamesSelected {
List {
ForEach(gameStore.games.filter({$0.inWishlist == self.showWishlist})) { game in
NavigationLink(destination: GameDetailView(gameVM: GameViewModel(game: game))) {
Text("\(game.name)")
}
}
}
}else {
List {
ForEach(accessoryStore.accessories.filter({$0.inWishlist == self.showWishlist})) { accessory in
NavigationLink(destination: AccessoryDetailView(accessoryVM: AccessoryViewModel(accessory: accessory))) {
Text("\(accessory.name)")
}
}
}
}
}.navigationBarTitle(Text("\(self.console?.name ?? "N/A")"), displayMode: .automatic)
.navigationBarItems(trailing:
HStack {
Button(action: {
self.isModal = true
}) {
Image(systemName: "plus")
}.padding(5)
Button(action: {
self.showWishlist.toggle()
}) {
Image(systemName: "star")
}.accentColor(self.showWishlist ? Color.red : Color.blue)
})
.sheet(isPresented: $isModal, onDismiss: {}, content: {
self.modal
})
}
init(console : Console?) {
self.console = console
self.gameStore = GameStore(console: console)
self.accessoryStore = AccessoryStore(console: console)
}
}
#if DEBUG
struct ConsoleLibraryView_Previews : PreviewProvider {
static var previews: some View {
ConsoleLibraryView(console: .none)
}
}
#endif

View File

@@ -0,0 +1,37 @@
//
// ConsolesListView.swift
// Zockerhoehle
//
// Created by Julian-Steffen Müller on 01.08.19.
// Copyright © 2019 Julian-Steffen Müller. All rights reserved.
//
import Foundation
import SwiftUI
struct ConsolesListView : View {
@ObservedObject var consoleStore : ConsoleStore = ConsoleStore()
@ObservedObject var gameStore : GameStore
var body: some View {
NavigationView {
List {
ForEach(consoleStore.consoles) {console in
//TODO environmentObject should not be passed through the hierarchy
//This is only for fixin a swiftui bug
NavigationLink(destination: ConsoleLibraryView(console: console)) {
Text("\(console.name)")
}
}
}.navigationBarTitle(Text("Zockerhöhle"))
}
}
}
#if DEBUG
struct ConsolesListView_Previews : PreviewProvider {
static var previews: some View {
ConsolesListView(gameStore: GameStore(console: .none))
}
}
#endif

View File

@@ -9,20 +9,54 @@
import SwiftUI
struct GameDetailView : View {
var game : Game?
//@Binding var g : Game
@ObservedObject var gameVM : GameViewModel
@State var hasFinishedDate : Bool = false
@State var playthroughDate : Date = Date()
var body: some View {
Text(game?.name ?? "N/A")
Form {
TextField("Videogame name", text: $gameVM.name)
Toggle(isOn: $gameVM.isDigital, label: {
Text("Nur Digital")
})
Toggle(isOn: $gameVM.inWishlist, label: {
Text("In Wunschliste")
})
Toggle(isOn: $gameVM.isFinished , label: {
Text("Durchgezockt")
})
if gameVM.isFinished {
Toggle(isOn: $hasFinishedDate, label: {
Text("Gibts ein Datum")
})
}
init(game : Game?) {
self.game = game
if hasFinishedDate && gameVM.isFinished {
DatePicker("Durchgezockt am",
selection: $playthroughDate,
in: ...Date(),
displayedComponents: [.date])
}
}.navigationBarTitle(Text("\(gameVM.name)"), displayMode: .automatic)
}
init(gameVM : GameViewModel?) {
self.gameVM = gameVM!
}
}
#if DEBUG
struct GameDetailView_Previews : PreviewProvider {
static var previews: some View {
GameDetailView(game: nil)
GameDetailView(gameVM: nil)
}
}
#endif

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="14865.6" systemVersion="18F132" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
<entity name="Accessory" representedClassName="Accessory" syncable="YES">
<attribute name="circumstances" optional="YES" attributeType="String"/>
<attribute name="color" optional="YES" attributeType="String"/>
<attribute name="inWishlist" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
<attribute name="manufacturer" optional="YES" attributeType="String"/>
@@ -8,46 +9,48 @@
<relationship name="console" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Console" inverseName="accessories" inverseEntity="Console"/>
</entity>
<entity name="Console" representedClassName="Console" syncable="YES">
<attribute name="circumstances" optional="YES" attributeType="String"/>
<attribute name="generation" optional="YES" attributeType="Integer 64" defaultValueString="0" usesScalarValueType="YES"/>
<attribute name="manufacturer" optional="YES" attributeType="String"/>
<attribute name="name" attributeType="String"/>
<relationship name="accessories" toMany="YES" deletionRule="Nullify" destinationEntity="Accessory" inverseName="console" inverseEntity="Accessory"/>
<relationship name="games" toMany="YES" deletionRule="Nullify" destinationEntity="Game" inverseName="console" inverseEntity="Game"/>
<relationship name="logo" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Logo" inverseName="console" inverseEntity="Logo"/>
<relationship name="logo" optional="YES" maxCount="1" deletionRule="Cascade" destinationEntity="Logo" inverseName="console" inverseEntity="Logo"/>
</entity>
<entity name="Cover" representedClassName="Cover" syncable="YES">
<attribute name="image" optional="YES" attributeType="Transformable"/>
<attribute name="image" optional="YES" attributeType="Transformable" valueTransformerName="NSSecureUnarchiveFromData"/>
<relationship name="game" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Game" inverseName="cover" inverseEntity="Game"/>
</entity>
<entity name="Game" representedClassName="Game" syncable="YES">
<attribute name="finished" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
<attribute name="circumstances" optional="YES" attributeType="String"/>
<attribute name="inWishlist" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
<attribute name="isDigital" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES"/>
<attribute name="isFinished" optional="YES" attributeType="Boolean" usesScalarValueType="YES"/>
<attribute name="name" attributeType="String"/>
<attribute name="notes" optional="YES" attributeType="String"/>
<attribute name="publisher" optional="YES" attributeType="String"/>
<relationship name="console" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Console" inverseName="games" inverseEntity="Console"/>
<relationship name="cover" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Cover" inverseName="game" inverseEntity="Cover"/>
<relationship name="cover" optional="YES" maxCount="1" deletionRule="Cascade" destinationEntity="Cover" inverseName="game" inverseEntity="Cover"/>
<relationship name="series" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="GameSeries" inverseName="games" inverseEntity="GameSeries"/>
<fetchedProperty name="fetchedProperty" optional="YES">
<fetchRequest name="fetchedPropertyFetchRequest" entity="Game"/>
</fetchedProperty>
</entity>
<entity name="GameSeries" representedClassName="GameSeries" syncable="YES">
<attribute name="cover" optional="YES" attributeType="Binary" allowsExternalBinaryDataStorage="YES"/>
<attribute name="cover" optional="YES" attributeType="Transformable" valueTransformerName="NSSecureUnarchiveFromData" allowsExternalBinaryDataStorage="YES"/>
<attribute name="name" optional="YES" attributeType="String"/>
<relationship name="games" toMany="YES" deletionRule="Nullify" destinationEntity="Game" inverseName="series" inverseEntity="Game"/>
</entity>
<entity name="Logo" representedClassName="Logo" syncable="YES">
<attribute name="image" optional="YES" attributeType="Transformable"/>
<attribute name="image" optional="YES" attributeType="Transformable" valueTransformerName="NSSecureUnarchiveFromData"/>
<relationship name="console" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="Console" inverseName="logo" inverseEntity="Console"/>
</entity>
<elements>
<element name="Accessory" positionX="-265.9140625" positionY="29.15625" width="128" height="118"/>
<element name="Console" positionX="-535.7890625" positionY="56.03515625" width="128" height="133"/>
<element name="Accessory" positionX="-265.9140625" positionY="29.15625" width="128" height="133"/>
<element name="Console" positionX="-535.7890625" positionY="56.03515625" width="128" height="148"/>
<element name="Cover" positionX="-66.69921875" positionY="223.48046875" width="128" height="73"/>
<element name="Game" positionX="-288.828125" positionY="276.7421875" width="128" height="206"/>
<element name="GameSeries" positionX="-519.2421875" positionY="317.87890625" width="128" height="88"/>
<element name="Game" positionX="-288.828125" positionY="276.7421875" width="128" height="221"/>
<element name="GameSeries" positionX="-686.828125" positionY="359.20703125" width="128" height="88"/>
<element name="Logo" positionX="-66.7109375" positionY="110.9765625" width="128" height="73"/>
</elements>
</model>

View File

@@ -1 +0,0 @@