Skip to content

Commit

Permalink
add tvOS support; remove SnapKit dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
xue-nd committed Dec 21, 2024
1 parent e642008 commit b0b4ebd
Show file tree
Hide file tree
Showing 53 changed files with 1,397 additions and 447 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,19 @@
6DCAA5B52C903C5400D63ED4 /* Form in Frameworks */ = {isa = PBXBuildFile; productRef = 6DCAA5B42C903C5400D63ED4 /* Form */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
6D20DF532D1717AC0010D80C /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6D20DF432D1717AC0010D80C /* Example-tvOS.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 6D20DF1A2D17159A0010D80C;
remoteInfo = "Example-tvOS";
};
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
6DCAA5992C903C0F00D63ED4 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
6D20DF432D1717AC0010D80C /* Example-tvOS.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = "Example-tvOS.xcodeproj"; sourceTree = "<group>"; };
6DCAA5992C903C0F00D63ED4 /* Example-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Example-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
6DCAA59C2C903C0F00D63ED4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
6DCAA59E2C903C0F00D63ED4 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
6DCAA5A02C903C0F00D63ED4 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
Expand All @@ -39,23 +50,32 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
6D20DF442D1717AC0010D80C /* Products */ = {
isa = PBXGroup;
children = (
6D20DF542D1717AC0010D80C /* Example-tvOS.app */,
);
name = Products;
sourceTree = "<group>";
};
6DCAA5902C903C0F00D63ED4 = {
isa = PBXGroup;
children = (
6DCAA59B2C903C0F00D63ED4 /* Example */,
6D20DF432D1717AC0010D80C /* Example-tvOS.xcodeproj */,
6DCAA59B2C903C0F00D63ED4 /* Example-iOS */,
6DCAA59A2C903C0F00D63ED4 /* Products */,
);
sourceTree = "<group>";
};
6DCAA59A2C903C0F00D63ED4 /* Products */ = {
isa = PBXGroup;
children = (
6DCAA5992C903C0F00D63ED4 /* Example.app */,
6DCAA5992C903C0F00D63ED4 /* Example-iOS.app */,
);
name = Products;
sourceTree = "<group>";
};
6DCAA59B2C903C0F00D63ED4 /* Example */ = {
6DCAA59B2C903C0F00D63ED4 /* Example-iOS */ = {
isa = PBXGroup;
children = (
6DCAA59C2C903C0F00D63ED4 /* AppDelegate.swift */,
Expand All @@ -66,15 +86,15 @@
6DCAA5A72C903C1000D63ED4 /* LaunchScreen.storyboard */,
6DCAA5AA2C903C1000D63ED4 /* Info.plist */,
);
path = Example;
path = "Example-iOS";
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
6DCAA5982C903C0F00D63ED4 /* Example */ = {
6DCAA5982C903C0F00D63ED4 /* Example-iOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 6DCAA5AD2C903C1000D63ED4 /* Build configuration list for PBXNativeTarget "Example" */;
buildConfigurationList = 6DCAA5AD2C903C1000D63ED4 /* Build configuration list for PBXNativeTarget "Example-iOS" */;
buildPhases = (
6DCAA5952C903C0F00D63ED4 /* Sources */,
6DCAA5962C903C0F00D63ED4 /* Frameworks */,
Expand All @@ -84,12 +104,12 @@
);
dependencies = (
);
name = Example;
name = "Example-iOS";
packageProductDependencies = (
6DCAA5B42C903C5400D63ED4 /* Form */,
);
productName = Example;
productReference = 6DCAA5992C903C0F00D63ED4 /* Example.app */;
productReference = 6DCAA5992C903C0F00D63ED4 /* Example-iOS.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
Expand All @@ -107,7 +127,7 @@
};
};
};
buildConfigurationList = 6DCAA5942C903C0F00D63ED4 /* Build configuration list for PBXProject "Example" */;
buildConfigurationList = 6DCAA5942C903C0F00D63ED4 /* Build configuration list for PBXProject "Example-iOS" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
Expand All @@ -121,13 +141,29 @@
);
productRefGroup = 6DCAA59A2C903C0F00D63ED4 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 6D20DF442D1717AC0010D80C /* Products */;
ProjectRef = 6D20DF432D1717AC0010D80C /* Example-tvOS.xcodeproj */;
},
);
projectRoot = "";
targets = (
6DCAA5982C903C0F00D63ED4 /* Example */,
6DCAA5982C903C0F00D63ED4 /* Example-iOS */,
);
};
/* End PBXProject section */

/* Begin PBXReferenceProxy section */
6D20DF542D1717AC0010D80C /* Example-tvOS.app */ = {
isa = PBXReferenceProxy;
fileType = wrapper.application;
path = "Example-tvOS.app";
remoteRef = 6D20DF532D1717AC0010D80C /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
6DCAA5972C903C0F00D63ED4 /* Resources */ = {
isa = PBXResourcesBuildPhase;
Expand Down Expand Up @@ -300,8 +336,9 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 3N577SK5F9;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Example/Info.plist;
INFOPLIST_FILE = "Example-iOS/Info.plist";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = Main;
Expand All @@ -327,8 +364,9 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 3N577SK5F9;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Example/Info.plist;
INFOPLIST_FILE = "Example-iOS/Info.plist";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = Main;
Expand All @@ -350,7 +388,7 @@
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
6DCAA5942C903C0F00D63ED4 /* Build configuration list for PBXProject "Example" */ = {
6DCAA5942C903C0F00D63ED4 /* Build configuration list for PBXProject "Example-iOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6DCAA5AB2C903C1000D63ED4 /* Debug */,
Expand All @@ -359,7 +397,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
6DCAA5AD2C903C1000D63ED4 /* Build configuration list for PBXNativeTarget "Example" */ = {
6DCAA5AD2C903C1000D63ED4 /* Build configuration list for PBXNativeTarget "Example-iOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
6DCAA5AE2C903C1000D63ED4 /* Debug */,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1620"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6DCAA5982C903C0F00D63ED4"
BuildableName = "Example-iOS.app"
BlueprintName = "Example-iOS"
ReferencedContainer = "container:Example-iOS.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6DCAA5982C903C0F00D63ED4"
BuildableName = "Example-iOS.app"
BlueprintName = "Example-iOS"
ReferencedContainer = "container:Example-iOS.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6DCAA5982C903C0F00D63ED4"
BuildableName = "Example-iOS.app"
BlueprintName = "Example-iOS"
ReferencedContainer = "container:Example-iOS.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,22 @@ import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
func application(_: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options _: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
func application(_: UIApplication, didDiscardSceneSessions _: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


}

52 changes: 52 additions & 0 deletions Example/Example-iOS/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Form" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kmm-9P-ZbY">
<rect key="frame" x="119" y="363" width="155" height="91"/>
<fontDescription key="fontDescription" name="MarkerFelt-Wide" family="Marker Felt" pointSize="70"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="for iOS" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iLE-UY-iY0">
<rect key="frame" x="155" y="484" width="83.333333333333314" height="32.666666666666629"/>
<fontDescription key="fontDescription" name="MarkerFelt-Thin" family="Marker Felt" pointSize="30"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemCyanColor"/>
<constraints>
<constraint firstItem="iLE-UY-iY0" firstAttribute="top" secondItem="kmm-9P-ZbY" secondAttribute="bottom" constant="30" id="2Tx-7d-PuQ"/>
<constraint firstItem="kmm-9P-ZbY" firstAttribute="centerY" secondItem="6Tk-OE-BBY" secondAttribute="centerY" constant="-30" id="DYn-M8-CLu"/>
<constraint firstItem="kmm-9P-ZbY" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="p24-Ef-yge"/>
<constraint firstItem="iLE-UY-iY0" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="zZL-91-yDS"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<systemColor name="systemCyanColor">
<color red="0.19607843137254902" green="0.67843137254901964" blue="0.90196078431372551" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,40 @@
import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?


func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
func scene(_ scene: UIScene, willConnectTo _: UISceneSession, options _: 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).
guard let _ = (scene as? UIWindowScene) else { return }
}

func sceneDidDisconnect(_ scene: UIScene) {
func sceneDidDisconnect(_: 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 necessarily discarded (see `application:didDiscardSceneSessions` instead).
}

func sceneDidBecomeActive(_ scene: UIScene) {
func sceneDidBecomeActive(_: 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) {
func sceneWillResignActive(_: 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) {
func sceneWillEnterForeground(_: 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) {
func sceneDidEnterBackground(_: 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.
}


}

Loading

0 comments on commit b0b4ebd

Please sign in to comment.