Adds support for Objective-C

This commit is contained in:
Steven Troughton-Smith 2021-09-13 15:50:50 +01:00
parent 447928c487
commit bbe6c48357
14 changed files with 452 additions and 8 deletions

View file

@ -0,0 +1,17 @@
//
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// ___COPYRIGHT___
//
@import UIKit;
NS_ASSUME_NONNULL_BEGIN
@interface ___VARIABLE_classPrefix___AppDelegate: UIResponder <UIApplicationDelegate>
@end
NS_ASSUME_NONNULL_END

View file

@ -0,0 +1,20 @@
//
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// ___COPYRIGHT___
//
@import UIKit;
#import "___VARIABLE_classPrefix___AppDelegate.h"
@implementation ___VARIABLE_classPrefix___AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return YES;
}
@end

View file

@ -0,0 +1,9 @@
//
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// ___COPYRIGHT___
//
@import UIKit;

View file

@ -0,0 +1,38 @@
//
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// ___COPYRIGHT___
//
@import UIKit;
#import "___VARIABLE_classPrefix___SceneDelegate.h"
#import "___VARIABLE_classPrefix___SceneDelegate+NSToolbar.h"
#if TARGET_OS_MACCATALYST
@import AppKit;
@implementation ___VARIABLE_classPrefix___SceneDelegate (NSToolbarDelegate)
- (NSArray<NSToolbarItemIdentifier> *)toolbarItemIdentifiers {
NSArray *toolbarItemsArray = [NSArray arrayWithObjects:NSToolbarToggleSidebarItemIdentifier, nil];
return toolbarItemsArray;
}
- (NSArray<NSToolbarItemIdentifier> *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar {
return [self toolbarItemIdentifiers];
}
- (NSArray<NSToolbarItemIdentifier> *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar {
return [self toolbarItemIdentifiers];
}
- (nullable NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSToolbarItemIdentifier)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag {
return [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier];
}
@end
#endif

View file

@ -0,0 +1,28 @@
//
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// ___COPYRIGHT___
//
@import UIKit;
#if TARGET_OS_MACCATALYST
@import AppKit;
#endif
NS_ASSUME_NONNULL_BEGIN
@interface ___VARIABLE_classPrefix___SceneDelegate: UIResponder
#if TARGET_OS_MACCATALYST
<UIWindowSceneDelegate, NSToolbarDelegate>
#else
<UIWindowSceneDelegate>
#endif
@property (nullable, nonatomic, strong) UIWindow *window;
@end
NS_ASSUME_NONNULL_END

View file

@ -0,0 +1,36 @@
//
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// ___COPYRIGHT___
//
@import UIKit;
#import "___VARIABLE_classPrefix___SceneDelegate.h"
#import "___VARIABLE_classPrefix___MainViewController.h"
@implementation ___VARIABLE_classPrefix___SceneDelegate
- (void)scene:(UIWindowScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
self.window = [[UIWindow alloc] initWithWindowScene:scene];
self.window.rootViewController = [[___VARIABLE_classPrefix___MainViewController alloc] init];
#if TARGET_OS_MACCATALYST
NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier:@"___VARIABLE_classPrefix___SceneDelegate.Toolbar"];
toolbar.delegate = self;
toolbar.displayMode = NSToolbarDisplayModeIconOnly;
toolbar.allowsUserCustomization = NO;
scene.titlebar.toolbar = toolbar;
scene.titlebar.toolbarStyle = UITitlebarToolbarStyleUnified;
#endif
[self.window makeKeyAndVisible];
}
@end

View file

@ -0,0 +1,17 @@
//
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// ___COPYRIGHT___
//
@import UIKit;
NS_ASSUME_NONNULL_BEGIN
@interface ___VARIABLE_classPrefix___MainViewController: UIViewController
@end
NS_ASSUME_NONNULL_END

View file

@ -0,0 +1,23 @@
//
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// ___COPYRIGHT___
//
@import UIKit;
#import "___VARIABLE_classPrefix___MainViewController.h"
@implementation ___VARIABLE_classPrefix___MainViewController
-(instancetype)init {
if (self = [super init]) {
self.title = @"___PROJECTNAME___";
}
return self;
}
@end

View file

@ -0,0 +1,16 @@
//
// ___FILENAME___
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// ___COPYRIGHT___
//
@import UIKit;
int main(int argc, char *argv[]) {
@autoreleasepool {
int retVal = UIApplicationMain(argc, argv, nil, @"___VARIABLE_classPrefix___AppDelegate");
return retVal;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View file

@ -9,6 +9,7 @@
<key>Ancestors</key>
<array>
<string>com.highcaffeinecontent.catalyst.base</string>
<string>com.apple.dt.unit.languageChoice</string>
</array>
<key>Concrete</key>
<true/>
@ -20,10 +21,6 @@
<string></string>
<key>Nodes</key>
<array>
<string>Source/Application/___VARIABLE_classPrefix___AppDelegate.swift</string>
<string>Source/Application/___VARIABLE_classPrefix___SceneDelegate.swift</string>
<string>Source/Application/___VARIABLE_classPrefix___SceneDelegate+NSToolbar.swift</string>
<string>Source/Main/___VARIABLE_classPrefix___MainViewController.swift</string>
<string>Assets.xcassets</string>
</array>
<key>Targets</key>
@ -61,6 +58,20 @@
<key>Path</key>
<string>Assets.xcassets</string>
</dict>
<key>Source/main.m</key>
<dict>
<key>Group</key>
<array>
<string>Source</string>
</array>
<key>Path</key>
<string>Source/main.m</string>
<key>RequiredOptions</key>
<dict>
<key>languageChoice</key>
<string>Objective-C</string>
</dict>
</dict>
<key>Source/Application/___VARIABLE_classPrefix___AppDelegate.swift</key>
<dict>
<key>Group</key>
@ -70,6 +81,45 @@
</array>
<key>Path</key>
<string>Source/Application/___VARIABLE_classPrefix___AppDelegate.swift</string>
<key>RequiredOptions</key>
<dict>
<key>languageChoice</key>
<string>Swift</string>
</dict>
</dict>
<key>Source/Application/___VARIABLE_classPrefix___AppDelegate.m</key>
<dict>
<key>Group</key>
<array>
<string>Source</string>
<string>Application</string>
</array>
<key>Path</key>
<string>Source/Application/___VARIABLE_classPrefix___AppDelegate.m</string>
<key>SortOrder</key>
<integer>1</integer>
<key>RequiredOptions</key>
<dict>
<key>languageChoice</key>
<string>Objective-C</string>
</dict>
</dict>
<key>Source/Application/___VARIABLE_classPrefix___AppDelegate.h</key>
<dict>
<key>Group</key>
<array>
<string>Source</string>
<string>Application</string>
</array>
<key>Path</key>
<string>Source/Application/___VARIABLE_classPrefix___AppDelegate.h</string>
<key>SortOrder</key>
<integer>0</integer>
<key>RequiredOptions</key>
<dict>
<key>languageChoice</key>
<string>Objective-C</string>
</dict>
</dict>
<key>Source/Application/___VARIABLE_classPrefix___SceneDelegate.swift</key>
<dict>
@ -80,6 +130,45 @@
</array>
<key>Path</key>
<string>Source/Application/___VARIABLE_classPrefix___SceneDelegate.swift</string>
<key>RequiredOptions</key>
<dict>
<key>languageChoice</key>
<string>Swift</string>
</dict>
</dict>
<key>Source/Application/___VARIABLE_classPrefix___SceneDelegate.m</key>
<dict>
<key>Group</key>
<array>
<string>Source</string>
<string>Application</string>
</array>
<key>Path</key>
<string>Source/Application/___VARIABLE_classPrefix___SceneDelegate.m</string>
<key>SortOrder</key>
<integer>3</integer>
<key>RequiredOptions</key>
<dict>
<key>languageChoice</key>
<string>Objective-C</string>
</dict>
</dict>
<key>Source/Application/___VARIABLE_classPrefix___SceneDelegate.h</key>
<dict>
<key>Group</key>
<array>
<string>Source</string>
<string>Application</string>
</array>
<key>Path</key>
<string>Source/Application/___VARIABLE_classPrefix___SceneDelegate.h</string>
<key>SortOrder</key>
<integer>2</integer>
<key>RequiredOptions</key>
<dict>
<key>languageChoice</key>
<string>Objective-C</string>
</dict>
</dict>
<key>Source/Application/___VARIABLE_classPrefix___SceneDelegate+NSToolbar.swift</key>
<dict>
@ -90,6 +179,45 @@
</array>
<key>Path</key>
<string>Source/Application/___VARIABLE_classPrefix___SceneDelegate+NSToolbar.swift</string>
<key>RequiredOptions</key>
<dict>
<key>languageChoice</key>
<string>Swift</string>
</dict>
</dict>
<key>Source/Application/___VARIABLE_classPrefix___SceneDelegate+NSToolbar.h</key>
<dict>
<key>Group</key>
<array>
<string>Source</string>
<string>Application</string>
</array>
<key>Path</key>
<string>Source/Application/___VARIABLE_classPrefix___SceneDelegate+NSToolbar.h</string>
<key>SortOrder</key>
<integer>4</integer>
<key>RequiredOptions</key>
<dict>
<key>languageChoice</key>
<string>Objective-C</string>
</dict>
</dict>
<key>Source/Application/___VARIABLE_classPrefix___SceneDelegate+NSToolbar.m</key>
<dict>
<key>Group</key>
<array>
<string>Source</string>
<string>Application</string>
</array>
<key>Path</key>
<string>Source/Application/___VARIABLE_classPrefix___SceneDelegate+NSToolbar.m</string>
<key>SortOrder</key>
<integer>5</integer>
<key>RequiredOptions</key>
<dict>
<key>languageChoice</key>
<string>Objective-C</string>
</dict>
</dict>
<key>Source/Main/___VARIABLE_classPrefix___MainViewController.swift</key>
<dict>
@ -100,9 +228,82 @@
</array>
<key>Path</key>
<string>Source/Main/___VARIABLE_classPrefix___MainViewController.swift</string>
<key>RequiredOptions</key>
<dict>
<key>languageChoice</key>
<string>Swift</string>
</dict>
</dict>
<key>Source/Main/___VARIABLE_classPrefix___MainViewController.m</key>
<dict>
<key>Group</key>
<array>
<string>Source</string>
<string>Main</string>
</array>
<key>Path</key>
<string>Source/Main/___VARIABLE_classPrefix___MainViewController.m</string>
<key>SortOrder</key>
<integer>1</integer>
<key>RequiredOptions</key>
<dict>
<key>languageChoice</key>
<string>Objective-C</string>
</dict>
</dict>
<key>Source/Main/___VARIABLE_classPrefix___MainViewController.h</key>
<dict>
<key>Group</key>
<array>
<string>Source</string>
<string>Main</string>
</array>
<key>Path</key>
<string>Source/Main/___VARIABLE_classPrefix___MainViewController.h</string>
<key>SortOrder</key>
<integer>0</integer>
<key>RequiredOptions</key>
<dict>
<key>languageChoice</key>
<string>Objective-C</string>
</dict>
</dict>
</dict>
<key>Options</key>
<array/>
<array>
<dict>
<key>Identifier</key>
<string>languageChoice</string>
<key>Units</key>
<dict>
<key>Objective-C</key>
<dict>
<key>Nodes</key>
<array>
<string>Source/Application/___VARIABLE_classPrefix___AppDelegate.m</string>
<string>Source/Application/___VARIABLE_classPrefix___AppDelegate.h</string>
<string>Source/Application/___VARIABLE_classPrefix___SceneDelegate.m</string>
<string>Source/Application/___VARIABLE_classPrefix___SceneDelegate.h</string>
<string>Source/Application/___VARIABLE_classPrefix___SceneDelegate+NSToolbar.m</string>
<string>Source/Application/___VARIABLE_classPrefix___SceneDelegate+NSToolbar.h</string>
<string>Source/Main/___VARIABLE_classPrefix___MainViewController.m</string>
<string>Source/Main/___VARIABLE_classPrefix___MainViewController.h</string>
<string>Source/main.m</string>
<string>Assets.xcassets</string>
</array>
</dict>
<key>Swift</key>
<dict>
<key>Nodes</key>
<array>
<string>Source/Application/___VARIABLE_classPrefix___AppDelegate.swift</string>
<string>Source/Application/___VARIABLE_classPrefix___SceneDelegate.swift</string>
<string>Source/Application/___VARIABLE_classPrefix___SceneDelegate+NSToolbar.swift</string>
<string>Source/Main/___VARIABLE_classPrefix___MainViewController.swift</string>
</array>
</dict>
</dict>
</dict>
</array>
</dict>
</plist>

View file

@ -54,7 +54,6 @@
<string>Info.plist:UISupportedInterfaceOrientations~iPhone</string>
<string>Info.plist:UISupportedInterfaceOrientations~iPad</string>
<string>Info.plist:ITSAppUsesNonExemptEncryption</string>
<string>Info.plist:UIApplicationSceneManifest</string>
<string>Info.plist:UIApplicationSupportsIndirectInputEvents</string>
<string>Base.lproj/LaunchScreen.storyboard</string>
</array>
@ -100,7 +99,7 @@
<string>&lt;key&gt;ITSAppUsesNonExemptEncryption&lt;/key&gt;
&lt;false/&gt;
</string>
<key>Info.plist:UIApplicationSceneManifest</key>
<key>Info.plist:UIApplicationSceneManifest-Swift</key>
<string>&lt;key&gt;UIApplicationSceneManifest&lt;/key&gt;
&lt;dict&gt;
&lt;key&gt;UIApplicationSupportsMultipleScenes&lt;/key&gt;
@ -118,6 +117,25 @@
&lt;/array&gt;
&lt;/dict&gt;
&lt;/dict&gt;
</string>
<key>Info.plist:UIApplicationSceneManifest-ObjectiveC</key>
<string>&lt;key&gt;UIApplicationSceneManifest&lt;/key&gt;
&lt;dict&gt;
&lt;key&gt;UIApplicationSupportsMultipleScenes&lt;/key&gt;
&lt;true/&gt;
&lt;key&gt;UISceneConfigurations&lt;/key&gt;
&lt;dict&gt;
&lt;key&gt;UIWindowSceneSessionRoleApplication&lt;/key&gt;
&lt;array&gt;
&lt;dict&gt;
&lt;key&gt;UISceneConfigurationName&lt;/key&gt;
&lt;string&gt;Default Configuration&lt;/string&gt;
&lt;key&gt;UISceneDelegateClassName&lt;/key&gt;
&lt;string&gt;___VARIABLE_classPrefix___SceneDelegate&lt;/string&gt;
&lt;/dict&gt;
&lt;/array&gt;
&lt;/dict&gt;
&lt;/dict&gt;
</string>
<key>Info.plist:UIApplicationSupportsIndirectInputEvents</key>
<string>&lt;key&gt;UIApplicationSupportsIndirectInputEvents&lt;/key&gt;
@ -155,6 +173,27 @@
<key>Placeholder</key>
<string>XYZ</string>
</dict>
<dict>
<key>Identifier</key>
<string>languageChoice</string>
<key>Units</key>
<dict>
<key>Objective-C</key>
<dict>
<key>Nodes</key>
<array>
<string>Info.plist:UIApplicationSceneManifest-ObjectiveC</string>
</array>
</dict>
<key>Swift</key>
<dict>
<key>Nodes</key>
<array>
<string>Info.plist:UIApplicationSceneManifest-Swift</string>
</array>
</dict>
</dict>
</dict>
</array>
</dict>
</plist>

View file

@ -1,6 +1,6 @@
# catalyst-xctemplates
Basic Mac Catalyst templates for Xcode 11+.
Basic Mac Catalyst templates for Xcode 11+. Swift & Objective-C.
## Installation