Skip to content

Commit

Permalink
feat: objc 지원
Browse files Browse the repository at this point in the history
  • Loading branch information
mqzkim committed Dec 18, 2023
1 parent 93b89af commit b473239
Show file tree
Hide file tree
Showing 33 changed files with 1,167 additions and 63 deletions.
233 changes: 233 additions & 0 deletions Examples/TossPayments.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6A637DA52B2AA84C0058C7FC"
BuildableName = "UIKit-Objc-Example.app"
BlueprintName = "UIKit-Objc-Example"
ReferencedContainer = "container:TossPayments.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 = "6A637DA52B2AA84C0058C7FC"
BuildableName = "UIKit-Objc-Example.app"
BlueprintName = "UIKit-Objc-Example"
ReferencedContainer = "container:TossPayments.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6A637DA52B2AA84C0058C7FC"
BuildableName = "UIKit-Objc-Example.app"
BlueprintName = "UIKit-Objc-Example"
ReferencedContainer = "container:TossPayments.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
1 change: 0 additions & 1 deletion Examples/UIKit-Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#if canImport(UIKit)
import UIKit
import TossPayments

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public final class Environment {
}
return scheme + "://"
}()
static let defaultClientKey = "test_ck_P24xLea5zVA5mxMkelxVQAMYNwW6"
static let defaultClientKey = "test_ck_5GePWvyJnrKdzdyY29b8gLzN97Eo"
static let defaultCustomerKey = "TOSSPAYMENTS"
static let defaultBrandpayRedirectURL: String = {
if let brandPayRedirectURL = Bundle.main.object(forInfoDictionaryKey: "BRANDPAY_REDIRECT_URL") as? String,
Expand Down
15 changes: 15 additions & 0 deletions Examples/UIKit-Objc-Example/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// AppDelegate.h
// UIKit-Objc-Example
//
// Created by 김진규 on 2023/12/14.
// Copyright © 2023 TossPayments, Inc. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>


@end

41 changes: 41 additions & 0 deletions Examples/UIKit-Objc-Example/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// AppDelegate.m
// UIKit-Objc-Example
//
// Created by 김진규 on 2023/12/14.
// Copyright © 2023 TossPayments, Inc. All rights reserved.
//

#import "AppDelegate.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}


#pragma mark - UISceneSession lifecycle


- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
}


- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
// 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.
}


@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions Examples/UIKit-Objc-Example/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
25 changes: 25 additions & 0 deletions Examples/UIKit-Objc-Example/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.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="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
32 changes: 32 additions & 0 deletions Examples/UIKit-Objc-Example/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/>
<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>
<!--Widget View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="WidgetViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-11" y="4"/>
</scene>
</scenes>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
18 changes: 18 additions & 0 deletions Examples/UIKit-Objc-Example/Base/BaseViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// ViewController.h
// UIKit-Objc-Example
//
// Created by 김진규 on 2023/12/14.
// Copyright © 2023 TossPayments, Inc. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface BaseViewController : UIViewController

@property UIScrollView *scrollView;
@property UIStackView *stackView;
@property NSLayoutConstraint *scrollViewBottomAnchorConstraint;

@end

57 changes: 57 additions & 0 deletions Examples/UIKit-Objc-Example/Base/BaseViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// BaseViewController.h
// UIKit-Objc-Example
//
// Created by 김진규 on 2023/12/14.
// Copyright © 2023 TossPayments, Inc. All rights reserved.
//

#import "BaseViewController.h"

@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
[super viewDidLoad];

UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectZero];
[scrollView setAlwaysBounceVertical:true];
[scrollView setKeyboardDismissMode:UIScrollViewKeyboardDismissModeOnDrag];

UIStackView *stackView = [[UIStackView alloc] initWithFrame:CGRectZero];
[stackView setSpacing:24];
[stackView setAxis:UILayoutConstraintAxisVertical];

[self.view addSubview:scrollView];
[scrollView addSubview:stackView];

[scrollView setTranslatesAutoresizingMaskIntoConstraints:false];
[stackView setTranslatesAutoresizingMaskIntoConstraints:false];

NSLayoutConstraint *scrollViewBottomAnchorConstraint = [scrollView.bottomAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.bottomAnchor];

[NSLayoutConstraint activateConstraints:@[
[scrollView.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor],
[scrollView.trailingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.trailingAnchor],
[scrollView.leadingAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.leadingAnchor],
[scrollView.widthAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.widthAnchor],
scrollViewBottomAnchorConstraint,
[stackView.topAnchor constraintEqualToAnchor:scrollView.safeAreaLayoutGuide.topAnchor],
[stackView.leadingAnchor constraintEqualToAnchor:scrollView.safeAreaLayoutGuide.leadingAnchor constant:24],
[stackView.trailingAnchor constraintEqualToAnchor:scrollView.safeAreaLayoutGuide.trailingAnchor constant:-24],
[stackView.widthAnchor constraintEqualToAnchor:scrollView.safeAreaLayoutGuide.widthAnchor constant:-48],
[stackView.bottomAnchor constraintEqualToAnchor:scrollView.safeAreaLayoutGuide.bottomAnchor]
]];

self.scrollView = scrollView;
self.stackView = stackView;
self.scrollViewBottomAnchorConstraint = scrollViewBottomAnchorConstraint;

}


@end

25 changes: 25 additions & 0 deletions Examples/UIKit-Objc-Example/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
</dict>
</plist>
16 changes: 16 additions & 0 deletions Examples/UIKit-Objc-Example/SceneDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// SceneDelegate.h
// UIKit-Objc-Example
//
// Created by 김진규 on 2023/12/14.
// Copyright © 2023 TossPayments, Inc. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>

@property (strong, nonatomic) UIWindow * window;

@end

Loading

0 comments on commit b473239

Please sign in to comment.