@@ -42,7 +42,7 @@ class UBKitManager {
4242 self . xcodeProjectYMLFileName = " project.yml "
4343 }
4444
45- func performTasks ( ) -> Result {
45+ func performGenerateTasks ( ) -> Result {
4646 print ( " \n ---------- " )
4747 print ( " Creating iOS Project " )
4848 print ( " ---------- " )
@@ -60,23 +60,39 @@ class UBKitManager {
6060 }
6161
6262 print ( " \n ---------- " )
63- print ( " Initializing projects " )
63+ print ( " Copying Unity Files " )
6464 print ( " ---------- " )
65- let refreshResult = refreshProjects ( )
65+ let copyFilesResult = copyUnityFiles ( refresh: false )
66+ guard copyFilesResult == . success else {
67+ return copyFilesResult
68+ }
69+
70+ return . success
71+ }
72+
73+ func performRefreshTasks( ) -> Result {
74+ print ( " \n ---------- " )
75+ print ( " Refreshing Xcode project " )
76+ print ( " ---------- " )
77+ let refreshResult = refreshXcodeProject ( )
6678 guard refreshResult == . success else {
6779 return refreshResult
6880 }
6981
7082 print ( " \n ---------- " )
7183 print ( " Copying Unity Files " )
7284 print ( " ---------- " )
73- let copyFilesResult = copyUnityFiles ( )
85+ let copyFilesResult = copyUnityFiles ( refresh : true )
7486 guard copyFilesResult == . success else {
7587 return copyFilesResult
7688 }
7789
7890 return . success
7991 }
92+ }
93+
94+ // MARK: - Generate
95+ private extension UBKitManager {
8096
8197 func createiOSProject( ) -> Result {
8298 let xcodeProject = XcodeProject (
@@ -92,26 +108,36 @@ class UBKitManager {
92108 let unityProject = UnityProject (
93109 projectName: config. projectName,
94110 workingPath: workingUnityFolderPath,
95- unityAppPath: config. unityPath
96- )
97- return unityProject. create ( )
98- }
99-
100- func refreshProjects( ) -> Result {
101- let refreshser = ProjectRefresher (
102- projectName: config. projectName,
103- workingPath: workingFolderPath,
111+ unityAppPath: config. unityPath,
104112 sceneName: config. unitySceneName
105113 )
106- return refreshser . refresh ( )
114+ return unityProject . create ( )
107115 }
108116
109- func copyUnityFiles( ) -> Result {
117+ func copyUnityFiles( refresh : Bool ) -> Result {
110118 let fileCopier = FileCopier (
111119 config: config,
112120 workingPath: workingUnityFolderPath,
113121 xcodeProjectPath: workingiOSFolderPath
114122 )
115- return fileCopier. copyFiles ( )
123+ return fileCopier. copyFiles ( refresh: refresh)
124+ }
125+
126+ func refreshProjects( ) -> Result {
127+ let refresher = ProjectRefresher ( config: config, workingPath: workingUnityFolderPath)
128+ return refresher. refresh ( )
129+ }
130+ }
131+
132+ // MARK: - Refresh
133+ private extension UBKitManager {
134+
135+ func refreshXcodeProject( ) -> Result {
136+ let refreshResult = refreshProjects ( )
137+ guard refreshResult == . success else {
138+ return refreshResult
139+ }
140+
141+ return . success
116142 }
117143}
0 commit comments