Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: objc 지원 #58

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
239 changes: 239 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>
16 changes: 16 additions & 0 deletions Examples/UIKit-Objc-Example/Base/BaseTextField.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// BaseTextField.h
// UIKit-Objc-Example
//
// Created by 김진규 on 2023/12/14.
// Copyright © 2023 TossPayments, Inc. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface BaseTextField : UIView

@property UITextField *textField;

@end

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

#import <UIKit/UIKit.h>
#import "BaseTextField.h"

@interface BaseTextField ()

@property NSString *title;
@property NSString *text;
@property UILabel *label;

@end

@implementation BaseTextField

- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setup];
}
return self;
}

- (void)setup
{
_textField = [[UITextField alloc] init];
_label = [[UILabel alloc] init];
_title = @"";
_text = @"";

[_label setText:_text];
[_textField setAdjustsFontSizeToFitWidth:YES];
[_textField setBorderStyle:UITextBorderStyleRoundedRect];
[_textField setClearButtonMode:UITextFieldViewModeAlways];

[self setTranslatesAutoresizingMaskIntoConstraints:NO];

[self addSubview:_label];
[self addSubview:_textField];
[_label setTranslatesAutoresizingMaskIntoConstraints:NO];
[_textField setTranslatesAutoresizingMaskIntoConstraints:NO];

[NSLayoutConstraint activateConstraints:@[
[_label.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
[_label.trailingAnchor constraintEqualToAnchor:self.trailingAnchor],
[_label.topAnchor constraintEqualToAnchor:self.topAnchor],
[_textField.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
[_textField.trailingAnchor constraintEqualToAnchor:self.trailingAnchor],
[_textField.topAnchor constraintEqualToAnchor:_label.bottomAnchor constant:8],
[_textField.bottomAnchor constraintEqualToAnchor:self.bottomAnchor],
]];
}

@end
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

Loading