Skip to content

Commit

Permalink
refactor!: Template Modernizing
Browse files Browse the repository at this point in the history
  • Loading branch information
dpogue committed Aug 13, 2024
1 parent 3960c14 commit f424e4b
Show file tree
Hide file tree
Showing 15 changed files with 379 additions and 428 deletions.
8 changes: 3 additions & 5 deletions lib/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,10 @@ class ProjectCreator {
['__PROJECT_NAME__.xcodeproj', 'project.pbxproj'],
['__PROJECT_NAME__', 'AppDelegate.h'],
['__PROJECT_NAME__', 'AppDelegate.m'],
['__PROJECT_NAME__', 'MainViewController.h'],
['__PROJECT_NAME__', 'MainViewController.m'],
['__PROJECT_NAME__', 'ViewController.h'],
['__PROJECT_NAME__', 'ViewController.m'],
['__PROJECT_NAME__', 'main.m'],
['__PROJECT_NAME__', '__PROJECT_NAME__-Info.plist'],
['__PROJECT_NAME__', '__PROJECT_NAME__-Prefix.pch']
['__PROJECT_NAME__', '__PROJECT_NAME__-Info.plist']
]) {
this.expandProjectNameInFileContents(this.projectPath(...p));
}
Expand All @@ -192,7 +191,6 @@ class ProjectCreator {
['__PROJECT_NAME__.xcworkspace'],
['__PROJECT_NAME__.xcodeproj'],
['__PROJECT_NAME__', '__PROJECT_NAME__-Info.plist'],
['__PROJECT_NAME__', '__PROJECT_NAME__-Prefix.pch'],
['__PROJECT_NAME__']
]) {
this.expandProjectNameInBaseName(this.projectPath(...p));
Expand Down
3 changes: 0 additions & 3 deletions templates/cordova/build-debug.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
//

#include "build.xcconfig"

GCC_PREPROCESSOR_DEFINITIONS = $(inherited) DEBUG=1

#include "build-extras.xcconfig"

// (CB-11792)
Expand Down
4 changes: 0 additions & 4 deletions templates/cordova/build-release.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
//

#include "build.xcconfig"

CODE_SIGN_IDENTITY = iPhone Distribution
CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Distribution

#include "build-extras.xcconfig"

// (CB-11792)
Expand Down
19 changes: 0 additions & 19 deletions templates/cordova/build.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,3 @@
// XCode build settings shared by all Build Configurations.
// Settings are overridden by configuration-level .xcconfig file (build-release/build-debug).
//

HEADER_SEARCH_PATHS = "$(TARGET_BUILD_DIR)/usr/local/lib/include" "$(OBJROOT)/UninstalledProducts/include" "$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include" "$(BUILT_PRODUCTS_DIR)"
OTHER_LDFLAGS = -ObjC

// Type of signing identity used for codesigning, resolves to first match of given type.
// "iPhone Developer": Development builds (default, local only; iOS Development certificate) or "iPhone Distribution": Distribution builds (Adhoc/In-House/AppStore; iOS Distribution certificate)
CODE_SIGN_IDENTITY = iPhone Developer
CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer

// (CB-9721) Set ENABLE_BITCODE to NO in build.xcconfig
ENABLE_BITCODE = NO

// (CB-9719) Set CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES to YES in build.xcconfig
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES

// (CB-10072)
SWIFT_OBJC_BRIDGING_HEADER = $(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h

GCC_PREPROCESSOR_DEFINITIONS = $(inherited) WK_WEB_VIEW_ONLY=$(WK_WEB_VIEW_ONLY)
478 changes: 239 additions & 239 deletions templates/project/__PROJECT_NAME__.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion templates/project/__PROJECT_NAME__/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
under the License.
*/

#import <Cordova/CDVAppDelegate.h>
#import <Cordova/Cordova.h>

@interface AppDelegate : CDVAppDelegate

Expand Down
15 changes: 10 additions & 5 deletions templates/project/__PROJECT_NAME__/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@ Licensed to the Apache Software Foundation (ASF) under one
*/

#import "AppDelegate.h"
#import "MainViewController.h"

@interface AppDelegate()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions
{
self.viewController = [[MainViewController alloc] init];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
#pragma mark - UISceneSession lifecycle

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options API_AVAILABLE(ios(13)) {
return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
}
#endif

@end
60 changes: 60 additions & 0 deletions templates/project/__PROJECT_NAME__/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" name="BackgroundColor"/>
</view>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="backgroundColor">
<color key="value" name="BackgroundColor"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="splashBackgroundColor">
<color key="value" name="SplashScreenBackgroundColor"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="showSplashScreen" value="YES"/>
</userDefinedRuntimeAttributes>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
<resources>
<namedColor name="BackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</namedColor>
<namedColor name="SplashScreenBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</namedColor>
</resources>
</document>

138 changes: 0 additions & 138 deletions templates/project/__PROJECT_NAME__/MainViewController.xib

This file was deleted.

29 changes: 29 additions & 0 deletions templates/project/__PROJECT_NAME__/SceneDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

#import <UIKit/UIKit.h>

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
API_AVAILABLE(ios(13))
@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>

@property (strong, nonatomic) UIWindow * window;

@end
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ Licensed to the Apache Software Foundation (ASF) under one
specific language governing permissions and limitations
under the License.
*/
//
// Prefix header for all source files of the '__PROJECT_NAME__' target in the '__PROJECT_NAME__' project
//

#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "SceneDelegate.h"

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
@interface SceneDelegate()

@end

@implementation SceneDelegate

@end
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
under the License.
*/

#import <Cordova/CDVViewController.h>
#import <Cordova/Cordova.h>

@interface MainViewController : CDVViewController
@interface ViewController : CDVViewController

@end
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Licensed to the Apache Software Foundation (ASF) under one
under the License.
*/

#import "MainViewController.h"
#import "ViewController.h"

@implementation MainViewController
@implementation ViewController

@end
Loading

0 comments on commit f424e4b

Please sign in to comment.