diff --git a/MLS/MLS.xcodeproj/project.pbxproj b/MLS/MLS.xcodeproj/project.pbxproj index 00b29d81..fdc14e09 100644 --- a/MLS/MLS.xcodeproj/project.pbxproj +++ b/MLS/MLS.xcodeproj/project.pbxproj @@ -51,10 +51,16 @@ 779A490E2E1AD26700ABDE4F /* BookmarkFeature.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 779A490C2E1AD26700ABDE4F /* BookmarkFeature.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 779A49102E1AD26D00ABDE4F /* BookmarkFeatureInterface.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 779A490F2E1AD26D00ABDE4F /* BookmarkFeatureInterface.framework */; }; 779A49112E1AD26D00ABDE4F /* BookmarkFeatureInterface.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 779A490F2E1AD26D00ABDE4F /* BookmarkFeatureInterface.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 77A293312F79989200845081 /* DesignSystem.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77A293302F79989200845081 /* DesignSystem.framework */; }; + 77A293322F79989200845081 /* DesignSystem.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 77A293302F79989200845081 /* DesignSystem.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 77B1F9952EE06A4E00AE4B4D /* RxGesture in Frameworks */ = {isa = PBXBuildFile; productRef = 77B1F9942EE06A4E00AE4B4D /* RxGesture */; }; 77E260412EEABEC40059E889 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 77E260402EEABEC40059E889 /* Settings.bundle */; }; 77EB18D62DED9256004FB380 /* AuthFeature.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 77EB18D52DED9256004FB380 /* AuthFeature.framework */; }; 77EB18D72DED9256004FB380 /* AuthFeature.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 77EB18D52DED9256004FB380 /* AuthFeature.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 77FA68B82F72C9C10064B6EB /* RxCocoa in Frameworks */ = {isa = PBXBuildFile; productRef = 77FA68B72F72C9C10064B6EB /* RxCocoa */; }; + 77FA68BA2F72C9C10064B6EB /* RxSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 77FA68B92F72C9C10064B6EB /* RxSwift */; }; + 77FA68BC2F72C9C70064B6EB /* SnapKit in Frameworks */ = {isa = PBXBuildFile; productRef = 77FA68BB2F72C9C70064B6EB /* SnapKit */; }; + 77FA68BE2F72CA490064B6EB /* MLSDesignSystem in Frameworks */ = {isa = PBXBuildFile; productRef = 77FA68BD2F72CA490064B6EB /* MLSDesignSystem */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -95,6 +101,17 @@ name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; }; + 77A293332F79989200845081 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 77A293322F79989200845081 /* DesignSystem.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ @@ -127,9 +144,12 @@ 7777F7072E9EAC0D00F53D68 /* MyPageFeatureInterface.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = MyPageFeatureInterface.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 779A490C2E1AD26700ABDE4F /* BookmarkFeature.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = BookmarkFeature.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 779A490F2E1AD26D00ABDE4F /* BookmarkFeatureInterface.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = BookmarkFeatureInterface.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 77A293302F79989200845081 /* DesignSystem.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DesignSystem.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 77BEB0402DBA84B0002FFCFC /* MLSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MLSTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 77E260402EEABEC40059E889 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = Settings.bundle; path = MLS/Resource/Settings.bundle; sourceTree = ""; }; 77EB18D52DED9256004FB380 /* AuthFeature.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = AuthFeature.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 77FA68752F72C6D80064B6EB /* MLSDesignSystem */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = MLSDesignSystem; path = Presentation/MLSDesignSystem; sourceTree = ""; }; + 77FA687A2F72C7360064B6EB /* MLSDesignSystemExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MLSDesignSystemExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ @@ -140,6 +160,13 @@ ); target = 087D3EE72DA7972C002F924D /* MLS */; }; + 77FA688B2F72C7380064B6EB /* Exceptions for "MLSDesignSystemExample" folder in "MLSDesignSystemExample" target */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + Info.plist, + ); + target = 77FA68792F72C7360064B6EB /* MLSDesignSystemExample */; + }; /* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ /* Begin PBXFileSystemSynchronizedRootGroup section */ @@ -156,6 +183,14 @@ path = MLSTests; sourceTree = ""; }; + 77FA687B2F72C7360064B6EB /* MLSDesignSystemExample */ = { + isa = PBXFileSystemSynchronizedRootGroup; + exceptions = ( + 77FA688B2F72C7380064B6EB /* Exceptions for "MLSDesignSystemExample" folder in "MLSDesignSystemExample" target */, + ); + path = MLSDesignSystemExample; + sourceTree = ""; + }; /* End PBXFileSystemSynchronizedRootGroup section */ /* Begin PBXFrameworksBuildPhase section */ @@ -201,6 +236,18 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 77FA68772F72C7360064B6EB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 77FA68BC2F72C9C70064B6EB /* SnapKit in Frameworks */, + 77FA68BA2F72C9C10064B6EB /* RxSwift in Frameworks */, + 77A293312F79989200845081 /* DesignSystem.framework in Frameworks */, + 77FA68BE2F72CA490064B6EB /* MLSDesignSystem in Frameworks */, + 77FA68B82F72C9C10064B6EB /* RxCocoa in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -249,6 +296,7 @@ 084A25312DB93A5400C395C0 /* Frameworks */ = { isa = PBXGroup; children = ( + 77A293302F79989200845081 /* DesignSystem.framework */, 7777F7062E9EAC0D00F53D68 /* MyPageFeature.framework */, 7777F7072E9EAC0D00F53D68 /* MyPageFeatureInterface.framework */, 7777F7002E9EAB8400F53D68 /* BookmarkFeature.framework */, @@ -277,11 +325,13 @@ 087D3EDF2DA7972C002F924D = { isa = PBXGroup; children = ( + 77FA68752F72C6D80064B6EB /* MLSDesignSystem */, 77E260402EEABEC40059E889 /* Settings.bundle */, 77660AD12DD0D361007A4EF3 /* KakaoConfig.xcconfig */, 085A7F742DAF99570046663F /* .swiftlint.yml */, 087D3EEA2DA7972C002F924D /* MLS */, 77BEB0412DBA84B0002FFCFC /* MLSTests */, + 77FA687B2F72C7360064B6EB /* MLSDesignSystemExample */, 084A25312DB93A5400C395C0 /* Frameworks */, 087D3EE92DA7972C002F924D /* Products */, ); @@ -292,6 +342,7 @@ children = ( 087D3EE82DA7972C002F924D /* MLS.app */, 77BEB0402DBA84B0002FFCFC /* MLSTests.xctest */, + 77FA687A2F72C7360064B6EB /* MLSDesignSystemExample.app */, ); name = Products; sourceTree = ""; @@ -357,6 +408,33 @@ productReference = 77BEB0402DBA84B0002FFCFC /* MLSTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + 77FA68792F72C7360064B6EB /* MLSDesignSystemExample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 77FA688C2F72C7380064B6EB /* Build configuration list for PBXNativeTarget "MLSDesignSystemExample" */; + buildPhases = ( + 77FA68762F72C7360064B6EB /* Sources */, + 77FA68772F72C7360064B6EB /* Frameworks */, + 77FA68782F72C7360064B6EB /* Resources */, + 77A293332F79989200845081 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 77FA687B2F72C7360064B6EB /* MLSDesignSystemExample */, + ); + name = MLSDesignSystemExample; + packageProductDependencies = ( + 77FA68B72F72C9C10064B6EB /* RxCocoa */, + 77FA68B92F72C9C10064B6EB /* RxSwift */, + 77FA68BB2F72C9C70064B6EB /* SnapKit */, + 77FA68BD2F72CA490064B6EB /* MLSDesignSystem */, + ); + productName = MLSDesignSystemExample; + productReference = 77FA687A2F72C7360064B6EB /* MLSDesignSystemExample.app */; + productType = "com.apple.product-type.application"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -364,7 +442,7 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1620; + LastSwiftUpdateCheck = 2610; LastUpgradeCheck = 1620; TargetAttributes = { 087D3EE72DA7972C002F924D = { @@ -374,6 +452,9 @@ CreatedOnToolsVersion = 16.2; TestTargetID = 087D3EE72DA7972C002F924D; }; + 77FA68792F72C7360064B6EB = { + CreatedOnToolsVersion = 26.1.1; + }; }; }; buildConfigurationList = 087D3EE32DA7972C002F924D /* Build configuration list for PBXProject "MLS" */; @@ -427,6 +508,7 @@ targets = ( 087D3EE72DA7972C002F924D /* MLS */, 77BEB03F2DBA84B0002FFCFC /* MLSTests */, + 77FA68792F72C7360064B6EB /* MLSDesignSystemExample */, ); }; /* End PBXProject section */ @@ -449,6 +531,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 77FA68782F72C7360064B6EB /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -487,6 +576,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 77FA68762F72C7360064B6EB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -737,6 +833,78 @@ }; name = Release; }; + 77FA688D2F72C7380064B6EB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = MLSDesignSystemExample/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.donggle.MLSDesignSystemExample.MLSDesignSystemExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; + SWIFT_APPROACHABLE_CONCURRENCY = YES; + SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Debug; + }; + 77FA688E2F72C7380064B6EB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = MLSDesignSystemExample/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 15.6; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.donggle.MLSDesignSystemExample.MLSDesignSystemExample; + PRODUCT_NAME = "$(TARGET_NAME)"; + STRING_CATALOG_GENERATE_SYMBOLS = YES; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; + SUPPORTS_MACCATALYST = NO; + SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; + SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; + SWIFT_APPROACHABLE_CONCURRENCY = YES; + SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -767,6 +935,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 77FA688C2F72C7380064B6EB /* Build configuration list for PBXNativeTarget "MLSDesignSystemExample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 77FA688D2F72C7380064B6EB /* Debug */, + 77FA688E2F72C7380064B6EB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ @@ -884,6 +1061,25 @@ package = 77B1F9932EE06A4E00AE4B4D /* XCRemoteSwiftPackageReference "RxGesture" */; productName = RxGesture; }; + 77FA68B72F72C9C10064B6EB /* RxCocoa */ = { + isa = XCSwiftPackageProductDependency; + package = 08ED49202DCFDE9C002C21A2 /* XCRemoteSwiftPackageReference "RxSwift" */; + productName = RxCocoa; + }; + 77FA68B92F72C9C10064B6EB /* RxSwift */ = { + isa = XCSwiftPackageProductDependency; + package = 08ED49202DCFDE9C002C21A2 /* XCRemoteSwiftPackageReference "RxSwift" */; + productName = RxSwift; + }; + 77FA68BB2F72C9C70064B6EB /* SnapKit */ = { + isa = XCSwiftPackageProductDependency; + package = 08ED4DAF2DCFE098002C21A2 /* XCRemoteSwiftPackageReference "SnapKit" */; + productName = SnapKit; + }; + 77FA68BD2F72CA490064B6EB /* MLSDesignSystem */ = { + isa = XCSwiftPackageProductDependency; + productName = MLSDesignSystem; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 087D3EE02DA7972C002F924D /* Project object */; diff --git a/MLS/MLSCore/Sources/MLSCore/BaseController/BaseViewController.swift b/MLS/MLSCore/Sources/MLSCore/BaseController/BaseViewController.swift new file mode 100644 index 00000000..aa5e7877 --- /dev/null +++ b/MLS/MLSCore/Sources/MLSCore/BaseController/BaseViewController.swift @@ -0,0 +1,55 @@ +import os +import UIKit + +import RxKeyboard +import RxSwift + +open class BaseViewController: UIViewController { + private let disposeBag = DisposeBag() + + public init() { + super.init(nibName: nil, bundle: nil) + os_log("➕init: \(String(describing: self))") + } + + @available(*, unavailable) + public required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + deinit { + os_log("➖deinit: \(String(describing: self))") + } +} + +// MARK: - Life Cycle +extension BaseViewController { + override open func viewDidLoad() { + super.viewDidLoad() + configureUI() + } +} + +// MARK: - SetUp +private extension BaseViewController { + func configureUI() { + navigationController?.navigationBar.isHidden = true + view.backgroundColor = .systemBackground + } +} + +// MARK: - Methods +public extension BaseViewController { + func setupKeyboard(inset: CGFloat = 0, completion: @escaping (CGFloat) -> Void) { + RxKeyboard.instance.visibleHeight + .drive(onNext: { [weak self] height in + guard let self = self else { return } + let safeBottom = self.view.safeAreaInsets.bottom + let inset = height > 0 + ? height - safeBottom + inset + : inset + completion(inset) + }) + .disposed(by: disposeBag) + } +} diff --git a/MLS/MLSDesignSystemExample/Application/AppDelegate.swift b/MLS/MLSDesignSystemExample/Application/AppDelegate.swift new file mode 100644 index 00000000..64289c01 --- /dev/null +++ b/MLS/MLSDesignSystemExample/Application/AppDelegate.swift @@ -0,0 +1,17 @@ +import UIKit + +import MLSDesignSystem + +@main +class AppDelegate: UIResponder, UIApplicationDelegate { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + FontManager.registerFonts() + return true + } + + func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { + return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) + } + + func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) {} +} diff --git a/MLS/MLSDesignSystemExample/Application/SceneDelegate.swift b/MLS/MLSDesignSystemExample/Application/SceneDelegate.swift new file mode 100644 index 00000000..6ef7f387 --- /dev/null +++ b/MLS/MLSDesignSystemExample/Application/SceneDelegate.swift @@ -0,0 +1,28 @@ +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + guard let windowScene = (scene as? UIWindowScene) else { return } + window = UIWindow(windowScene: windowScene) + window?.rootViewController = UINavigationController(rootViewController: ViewController()) + window?.makeKeyAndVisible() + } + + func sceneDidDisconnect(_ scene: UIScene) { + } + + func sceneDidBecomeActive(_ scene: UIScene) { + } + + func sceneWillResignActive(_ scene: UIScene) { + } + + func sceneWillEnterForeground(_ scene: UIScene) { + } + + func sceneDidEnterBackground(_ scene: UIScene) { + } +} diff --git a/MLS/MLSDesignSystemExample/Assets.xcassets/AccentColor.colorset/Contents.json b/MLS/MLSDesignSystemExample/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 00000000..eb878970 --- /dev/null +++ b/MLS/MLSDesignSystemExample/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MLS/MLSDesignSystemExample/Assets.xcassets/AppIcon.appiconset/Contents.json b/MLS/MLSDesignSystemExample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..23058801 --- /dev/null +++ b/MLS/MLSDesignSystemExample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,35 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "tinted" + } + ], + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MLS/MLSDesignSystemExample/Assets.xcassets/Contents.json b/MLS/MLSDesignSystemExample/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/MLS/MLSDesignSystemExample/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MLS/MLSDesignSystemExample/Base.lproj/LaunchScreen.storyboard b/MLS/MLSDesignSystemExample/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..865e9329 --- /dev/null +++ b/MLS/MLSDesignSystemExample/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/BadgeTestController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/BadgeTestController.swift new file mode 100644 index 00000000..5d45db6e --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/BadgeTestController.swift @@ -0,0 +1,71 @@ +import UIKit + +import MLSDesignSystem + +import RxSwift +import SnapKit + +final class BadgeTestController: UIViewController { + + // MARK: - Properties + var disposeBag = DisposeBag() + private let currentBadge = Badge(style: .currentQuest) + private let preBadge = Badge(style: .preQuest) + private let nextBadge = Badge(style: .nextQuest) + private let elementBadge = Badge(style: .element("불 약점")) + + init() { + super.init(nibName: nil, bundle: nil) + title = "Badge" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Life Cycle +extension BadgeTestController { + override func viewDidLoad() { + super.viewDidLoad() + + addViews() + setupConstraints() + configureUI() + } +} + +// MARK: - SetUp +private extension BadgeTestController { + func addViews() { + view.addSubview(currentBadge) + view.addSubview(preBadge) + view.addSubview(nextBadge) + view.addSubview(elementBadge) + } + + func setupConstraints() { + currentBadge.snp.makeConstraints { make in + make.center.equalToSuperview() + } + + preBadge.snp.makeConstraints { make in + make.top.equalTo(currentBadge.snp.bottom).offset(16) + make.centerX.equalToSuperview() + } + + nextBadge.snp.makeConstraints { make in + make.top.equalTo(preBadge.snp.bottom).offset(16) + make.centerX.equalToSuperview() + } + + elementBadge.snp.makeConstraints { make in + make.top.equalTo(nextBadge.snp.bottom).offset(16) + make.centerX.equalToSuperview() + } + } + + func configureUI() { + view.backgroundColor = .systemBackground + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/CardListTestViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/CardListTestViewController.swift new file mode 100644 index 00000000..5fc9c948 --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/CardListTestViewController.swift @@ -0,0 +1,139 @@ +import UIKit + +import MLSDesignSystem + +import RxCocoa +import RxSwift +import SnapKit + +final class CardListTestViewController: UIViewController { + + // MARK: - Properties + var disposeBag = DisposeBag() + private let cardList = CardList() + + private let mainTextTextField: UITextField = { + let view = UITextField() + view.placeholder = "main" + view.text = "text" + view.layer.borderColor = UIColor.gray.cgColor + view.layer.borderWidth = 1 + return view + }() + + private let mainTextTextLabel: UILabel = { + let label = UILabel() + label.text = "main" + return label + }() + + private let subTextTextField: UITextField = { + let view = UITextField() + view.placeholder = "sub" + view.text = "text" + view.layer.borderColor = UIColor.gray.cgColor + view.layer.borderWidth = 1 + return view + }() + + private let subTextTextLabel: UILabel = { + let label = UILabel() + label.text = "sub" + return label + }() + + private let cardListToggle = ToggleBox(text: "isBookmark") + + init() { + super.init(nibName: nil, bundle: nil) + self.title = "CardList" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Life Cycle +extension CardListTestViewController { + override func viewDidLoad() { + super.viewDidLoad() + + addViews() + setupConstraints() + configureUI() + bind() + } +} + +// MARK: - SetUp +private extension CardListTestViewController { + func addViews() { + view.addSubview(cardList) + view.addSubview(mainTextTextLabel) + view.addSubview(mainTextTextField) + view.addSubview(subTextTextLabel) + view.addSubview(subTextTextField) + view.addSubview(cardListToggle) + } + + func setupConstraints() { + cardList.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).inset(16) + make.horizontalEdges.equalToSuperview().inset(16) + } + + mainTextTextLabel.snp.makeConstraints { make in + make.top.equalTo(cardList.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + mainTextTextField.snp.makeConstraints { make in + make.top.equalTo(mainTextTextLabel.snp.bottom).offset(10) + make.horizontalEdges.equalToSuperview().inset(16) + } + + subTextTextLabel.snp.makeConstraints { make in + make.top.equalTo(mainTextTextField.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + subTextTextField.snp.makeConstraints { make in + make.top.equalTo(subTextTextLabel.snp.bottom).offset(10) + make.horizontalEdges.equalToSuperview().inset(16) + } + + cardListToggle.snp.makeConstraints { make in + make.top.equalTo(subTextTextField.snp.bottom).offset(10) + make.horizontalEdges.equalToSuperview().inset(16) + } + } + + func configureUI() { + view.backgroundColor = .systemBackground + self.cardList.setImage(image: DesignSystemAsset.image(named: "testImage"), backgroundColor: .listMap) + } + + func bind() { + mainTextTextField.rx.text + .withUnretained(self) + .subscribe { (owner, text) in + owner.cardList.mainText = text + } + .disposed(by: disposeBag) + + subTextTextField.rx.text + .withUnretained(self) + .subscribe { (owner, text) in + owner.cardList.subText = text + } + .disposed(by: disposeBag) + + cardListToggle.toggle.rx.isOn + .withUnretained(self) + .subscribe { (owner, isOn) in + owner.cardList.isIconSelected = isOn + } + .disposed(by: disposeBag) + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/CheckBoxButtonTestViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/CheckBoxButtonTestViewController.swift new file mode 100644 index 00000000..14f23c5b --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/CheckBoxButtonTestViewController.swift @@ -0,0 +1,211 @@ +import UIKit + +import MLSDesignSystem + +import RxCocoa +import RxSwift +import SnapKit + +final class CheckBoxButtonTestViewController: UIViewController { + // MARK: - Properties + private var disposeBag = DisposeBag() + private var normalButton = CheckBoxButton(style: .normal, mainTitle: nil, subTitle: nil) + private var smallButton = CheckBoxButton(style: .listSmall, mainTitle: nil, subTitle: nil) + private var mediumButton = CheckBoxButton(style: .listMedium, mainTitle: nil, subTitle: nil) + private var largeButton = CheckBoxButton(style: .listLarge, mainTitle: nil, subTitle: nil) + + private let typeSegmentControl: UISegmentedControl = { + let items = ["normal", "listSmall", "listMedium", "listLarge"] + let control = UISegmentedControl(items: items) + control.selectedSegmentIndex = 0 + return control + }() + + private let mainTitleTextField: UITextField = { + let view = UITextField() + view.placeholder = "MainTitle" + view.text = "MainTitle" + view.layer.borderColor = UIColor.gray.cgColor + view.layer.borderWidth = 1 + return view + }() + + private let subTitleTextField: UITextField = { + let view = UITextField() + view.placeholder = "SubTitle" + view.text = "SubTitle" + view.layer.borderColor = UIColor.gray.cgColor + view.layer.borderWidth = 1 + return view + }() + + private let mainTitleTextLabel: UILabel = { + let label = UILabel() + label.text = "MainTitle" + return label + }() + + private let subTitleTextLabel: UILabel = { + let label = UILabel() + label.text = "SubTitle" + return label + }() + + init() { + super.init(nibName: nil, bundle: nil) + self.title = "CheckBoxButton" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} + +// MARK: - Life Cycle +extension CheckBoxButtonTestViewController { + override func viewDidLoad() { + super.viewDidLoad() + self.addViews() + self.setupConstraints() + self.configureUI() + self.bind() + } +} + +// MARK: - SetUp +private extension CheckBoxButtonTestViewController { + func addViews() { + view.addSubview(normalButton) + view.addSubview(smallButton) + view.addSubview(mediumButton) + view.addSubview(largeButton) + view.addSubview(typeSegmentControl) + view.addSubview(mainTitleTextLabel) + view.addSubview(mainTitleTextField) + view.addSubview(subTitleTextLabel) + view.addSubview(subTitleTextField) + } + + func setupConstraints() { + normalButton.snp.makeConstraints { make in + make.horizontalEdges.top.equalTo(view.safeAreaLayoutGuide).inset(16) + } + + smallButton.snp.makeConstraints { make in + make.horizontalEdges.top.equalTo(view.safeAreaLayoutGuide).inset(16) + } + + mediumButton.snp.makeConstraints { make in + make.horizontalEdges.top.equalTo(view.safeAreaLayoutGuide).inset(16) + } + + largeButton.snp.makeConstraints { make in + make.horizontalEdges.top.equalTo(view.safeAreaLayoutGuide).inset(16) + } + + typeSegmentControl.snp.makeConstraints { make in + make.top.equalTo(normalButton.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + mainTitleTextLabel.snp.makeConstraints { make in + make.top.equalTo(typeSegmentControl.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + mainTitleTextField.snp.makeConstraints { make in + make.top.equalTo(mainTitleTextLabel.snp.bottom).offset(10) + make.horizontalEdges.equalToSuperview().inset(16) + } + + subTitleTextLabel.snp.makeConstraints { make in + make.top.equalTo(mainTitleTextField.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + subTitleTextField.snp.makeConstraints { make in + make.top.equalTo(subTitleTextLabel.snp.bottom).offset(10) + make.horizontalEdges.equalToSuperview().inset(16) + } + } + + func configureUI() { + view.backgroundColor = .systemBackground + } + + func bind() { + normalButton.rx.tap + .withUnretained(self) + .subscribe { (owner, _) in + owner.normalButton.isSelected.toggle() + } + .disposed(by: disposeBag) + + smallButton.rx.tap + .withUnretained(self) + .subscribe { (owner, _) in + owner.smallButton.isSelected.toggle() + } + .disposed(by: disposeBag) + + mediumButton.rx.tap + .withUnretained(self) + .subscribe { (owner, _) in + owner.mediumButton.isSelected.toggle() + } + .disposed(by: disposeBag) + + largeButton.rx.tap + .withUnretained(self) + .subscribe { (owner, _) in + owner.largeButton.isSelected.toggle() + } + .disposed(by: disposeBag) + + typeSegmentControl.rx.selectedSegmentIndex + .withUnretained(self) + .subscribe { (owner, index) in + switch index { + case 0: + owner.normalButton.isHidden = false + owner.smallButton.isHidden = true + owner.mediumButton.isHidden = true + owner.largeButton.isHidden = true + case 1: + owner.normalButton.isHidden = true + owner.smallButton.isHidden = false + owner.mediumButton.isHidden = true + owner.largeButton.isHidden = true + case 2: + owner.normalButton.isHidden = true + owner.smallButton.isHidden = true + owner.mediumButton.isHidden = false + owner.largeButton.isHidden = true + default: + owner.normalButton.isHidden = true + owner.smallButton.isHidden = true + owner.mediumButton.isHidden = true + owner.largeButton.isHidden = false + } + } + .disposed(by: disposeBag) + + mainTitleTextField.rx.text + .withUnretained(self) + .subscribe { (owner, text) in + owner.normalButton.mainTitle = text + owner.smallButton.mainTitle = text + owner.mediumButton.mainTitle = text + owner.largeButton.mainTitle = text + } + .disposed(by: disposeBag) + + subTitleTextField.rx.text + .withUnretained(self) + .subscribe { (owner, text) in + owner.normalButton.subTitle = text + } + .disposed(by: disposeBag) + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/CollectionListTestViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/CollectionListTestViewController.swift new file mode 100644 index 00000000..62bd76a7 --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/CollectionListTestViewController.swift @@ -0,0 +1,54 @@ +import UIKit + +import MLSDesignSystem + +import RxSwift +import SnapKit + +final class CollectionListTestViewController: UIViewController { + + // MARK: - Properties + var disposeBag = DisposeBag() + + let collection = CollectionList() + + init() { + super.init(nibName: nil, bundle: nil) + self.title = "CollectionList" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Life Cycle +extension CollectionListTestViewController { + override func viewDidLoad() { + super.viewDidLoad() + + self.addViews() + self.setupConstraints() + self.configureUI() + } +} + +// MARK: - SetUp +private extension CollectionListTestViewController { + func addViews() { + self.view.addSubview(collection) + } + + func setupConstraints() { + collection.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).inset(16) + make.horizontalEdges.equalToSuperview().inset(16) + } + } + + func configureUI() { + self.view.backgroundColor = .neutral200 + collection.setTitle(text: "글자수는 10글자 이후부터 생략입니다.") + collection.setSubtitle(text: "$n개") + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/CommonButtonTestViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/CommonButtonTestViewController.swift new file mode 100644 index 00000000..313178b0 --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/CommonButtonTestViewController.swift @@ -0,0 +1,119 @@ +import UIKit + +import MLSDesignSystem + +import RxCocoa +import RxSwift +import SnapKit + +final class CommonButtonTestViewController: UIViewController { + + // MARK: - Properties + var disposeBag = DisposeBag() + private let commonButton = CommonButton(style: .normal, title: "NormalTitle", disabledTitle: "DisabledTitle") + private let textButton = CommonButton(style: .text, title: "NormalTitle", disabledTitle: "DisabledTitle") + private let borderButton = CommonButton(style: .border, title: "NormalTitle", disabledTitle: "DisabledTitle") + + private let typeSegmentControl: UISegmentedControl = { + let items = ["normal", "text", "border"] + let control = UISegmentedControl(items: items) + control.selectedSegmentIndex = 0 + return control + }() + + private let buttonStateToggle = ToggleBox(text: "isEnabled") + init() { + super.init(nibName: nil, bundle: nil) + self.title = "CommonButton" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Life Cycle +extension CommonButtonTestViewController { + override func viewDidLoad() { + super.viewDidLoad() + + addViews() + setupConstraints() + configureUI() + bind() + } +} + +// MARK: - SetUp +private extension CommonButtonTestViewController { + func addViews() { + view.addSubview(commonButton) + view.addSubview(textButton) + view.addSubview(borderButton) + view.addSubview(typeSegmentControl) + view.addSubview(buttonStateToggle) + } + + func setupConstraints() { + commonButton.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).inset(16) + make.horizontalEdges.equalToSuperview().inset(16) + } + + textButton.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).inset(16) + make.centerX.equalToSuperview() + } + + borderButton.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).inset(16) + make.horizontalEdges.equalToSuperview().inset(16) + } + + typeSegmentControl.snp.makeConstraints { make in + make.top.equalTo(textButton.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + buttonStateToggle.snp.makeConstraints { make in + make.top.equalTo(typeSegmentControl.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + } + + func configureUI() { + self.view.backgroundColor = .systemBackground + self.title = "CommonButton" + } + + func bind() { + self.typeSegmentControl.rx.selectedSegmentIndex + .withUnretained(self) + .subscribe { owner, selectedIndex in + switch selectedIndex { + case 0: + owner.commonButton.isHidden = false + owner.textButton.isHidden = true + owner.borderButton.isHidden = true + case 1: + owner.commonButton.isHidden = true + owner.textButton.isHidden = false + owner.borderButton.isHidden = true + default: + owner.commonButton.isHidden = true + owner.textButton.isHidden = true + owner.borderButton.isHidden = false + } + } + .disposed(by: disposeBag) + + self.buttonStateToggle.toggle.rx.isOn + .withUnretained(self) + .subscribe { (owner, isOn) in + owner.commonButton.isEnabled = isOn + owner.textButton.isEnabled = isOn + owner.borderButton.isEnabled = isOn + } + .disposed(by: disposeBag) + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/DictionaryDetailViewTestController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/DictionaryDetailViewTestController.swift new file mode 100644 index 00000000..ca7e3c12 --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/DictionaryDetailViewTestController.swift @@ -0,0 +1,75 @@ +import UIKit + +import MLSDesignSystem + +import RxSwift +import SnapKit + +final class DictionaryDetailViewTestController: UIViewController { + + // MARK: - Properties + var disposeBag = DisposeBag() + private let first = DictionaryDetailListView() + private let second = DictionaryDetailListView() + private let third = DictionaryDetailListView() + private let forth = DictionaryDetailListView() + + init() { + super.init(nibName: nil, bundle: nil) + title = "DictionaryDetailView" + first.update(clickableMainText: "mainText", additionalText: "text", clickableSubText: "text") + second.update(mainText: "mainText", clickableSubText: "text") + third.update(mainText: "mainText", subText: "text") + forth.update(clickableMainText: "mainText", clickableSubText: "text") + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Life Cycle +extension DictionaryDetailViewTestController { + override func viewDidLoad() { + super.viewDidLoad() + + addViews() + setupConstraints() + configureUI() + } +} + +// MARK: - SetUp +private extension DictionaryDetailViewTestController { + func addViews() { + view.addSubview(first) + view.addSubview(second) + view.addSubview(third) + view.addSubview(forth) + } + + func setupConstraints() { + first.snp.makeConstraints { make in + make.horizontalEdges.centerY.equalToSuperview() + } + + second.snp.makeConstraints { make in + make.top.equalTo(first.snp.bottom).offset(16) + make.horizontalEdges.equalToSuperview() + } + + third.snp.makeConstraints { make in + make.top.equalTo(second.snp.bottom).offset(16) + make.horizontalEdges.equalToSuperview() + } + + forth.snp.makeConstraints { make in + make.top.equalTo(third.snp.bottom).offset(16) + make.horizontalEdges.equalToSuperview() + } + } + + func configureUI() { + view.backgroundColor = .systemBackground + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/DropDwonBoxTestViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/DropDwonBoxTestViewController.swift new file mode 100644 index 00000000..431e81a4 --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/DropDwonBoxTestViewController.swift @@ -0,0 +1,161 @@ +import UIKit + +import MLSDesignSystem + +import RxCocoa +import RxSwift +import SnapKit + +final class DropDownBoxTextViewController: UIViewController { + // MARK: - Properties + private var disposeBag = DisposeBag() + private var dropDownBox = DropDownBox(items: [DropDownBox.Item(name: "하나", id: 1), DropDownBox.Item(name: "둘", id: 2)]) + private lazy var inputBox = dropDownBox.inputBox + + private let labelTextField: UITextField = { + let view = UITextField() + view.placeholder = "label" + view.text = "label" + view.layer.borderColor = UIColor.gray.cgColor + view.layer.borderWidth = 1 + return view + }() + + private let placeHolderTextField: UITextField = { + let view = UITextField() + view.placeholder = "placeHolder" + view.text = "placeHolder" + view.layer.borderColor = UIColor.gray.cgColor + view.layer.borderWidth = 1 + return view + }() + + private let countTextField: UITextField = { + let view = UITextField() + view.placeholder = "count" + view.text = "4" + view.layer.borderColor = UIColor.gray.cgColor + view.layer.borderWidth = 1 + view.keyboardType = .numberPad + return view + }() + + private let labelTextLabel: UILabel = { + let label = UILabel() + label.text = "label" + return label + }() + + private let placeHolderTextLabel: UILabel = { + let label = UILabel() + label.text = "placeHolder" + return label + }() + + private let countTextLabel: UILabel = { + let label = UILabel() + label.text = "메뉴개수" + return label + }() + + init() { + super.init(nibName: nil, bundle: nil) + self.title = "DropDownBox" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} + +// MARK: - Life Cycle +extension DropDownBoxTextViewController { + override func viewDidLoad() { + super.viewDidLoad() + self.addViews() + self.setupConstraints() + self.configureUI() + self.bind() + } +} + +// MARK: - SetUp +private extension DropDownBoxTextViewController { + func addViews() { + view.addSubview(labelTextLabel) + view.addSubview(labelTextField) + view.addSubview(placeHolderTextLabel) + view.addSubview(placeHolderTextField) + view.addSubview(countTextLabel) + view.addSubview(countTextField) + view.addSubview(dropDownBox) + } + + func setupConstraints() { + dropDownBox.snp.makeConstraints { make in + make.horizontalEdges.top.equalTo(view.safeAreaLayoutGuide).inset(16) + } + + labelTextLabel.snp.makeConstraints { make in + make.top.equalTo(dropDownBox.snp.bottom).offset(10) + make.horizontalEdges.equalToSuperview().inset(16) + } + + labelTextField.snp.makeConstraints { make in + make.top.equalTo(labelTextLabel.snp.bottom).offset(10) + make.horizontalEdges.equalToSuperview().inset(16) + } + + placeHolderTextLabel.snp.makeConstraints { make in + make.top.equalTo(labelTextField.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + placeHolderTextField.snp.makeConstraints { make in + make.top.equalTo(placeHolderTextLabel.snp.bottom).offset(10) + make.horizontalEdges.equalToSuperview().inset(16) + } + + countTextLabel.snp.makeConstraints { make in + make.top.equalTo(placeHolderTextField.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + countTextField.snp.makeConstraints { make in + make.top.equalTo(countTextLabel.snp.bottom).offset(10) + make.horizontalEdges.equalToSuperview().inset(16) + } + } + + func configureUI() { + view.backgroundColor = .systemBackground + } + + func bind() { + labelTextField.rx.text + .withUnretained(self) + .subscribe { owner, text in + owner.inputBox.label.attributedText = .makeStyledString(font: .b_s_r, text: text, color: .neutral700, alignment: .left) + } + .disposed(by: disposeBag) + + placeHolderTextField.rx.text + .withUnretained(self) + .subscribe { owner, text in + owner.inputBox.textField.attributedPlaceholder = .makeStyledString(font: .b_m_r, text: text, color: .neutral500, alignment: .left) + } + .disposed(by: disposeBag) + + countTextField.rx.text + .withUnretained(self) + .subscribe { (owner, count) in + guard let count = Int(count ?? "") else { return } + owner.dropDownBox.items = [] + for index in 1...count { + owner.dropDownBox.items.append(DropDownBox.Item(name: "메뉴\(index)", id: index)) + } + } + .disposed(by: disposeBag) + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/ErrorMessageTextViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/ErrorMessageTextViewController.swift new file mode 100644 index 00000000..7ab8b8e7 --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/ErrorMessageTextViewController.swift @@ -0,0 +1,88 @@ +import UIKit + +import MLSDesignSystem + +import RxCocoa +import RxSwift +import SnapKit + +final class ErrorMessageTextViewController: UIViewController { + // MARK: - Properties + private var disposeBag = DisposeBag() + private var errorMessage = ErrorMessage(message: nil) + + private let messageTextField: UITextField = { + let view = UITextField() + view.placeholder = "message" + view.text = "error" + view.layer.borderColor = UIColor.gray.cgColor + view.layer.borderWidth = 1 + return view + }() + + private let messageTextLabel: UILabel = { + let label = UILabel() + label.text = "message" + return label + }() + + init() { + super.init(nibName: nil, bundle: nil) + self.title = "ErrorMessage" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} + +// MARK: - Life Cycle +extension ErrorMessageTextViewController { + override func viewDidLoad() { + super.viewDidLoad() + self.addViews() + self.setupConstraints() + self.configureUI() + self.bind() + } +} + +// MARK: - SetUp +private extension ErrorMessageTextViewController { + func addViews() { + view.addSubview(errorMessage) + view.addSubview(messageTextLabel) + view.addSubview(messageTextField) + } + + func setupConstraints() { + errorMessage.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).inset(16) + make.centerX.equalToSuperview() + } + + messageTextLabel.snp.makeConstraints { make in + make.top.equalTo(errorMessage.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + messageTextField.snp.makeConstraints { make in + make.top.equalTo(messageTextLabel.snp.bottom).offset(10) + make.horizontalEdges.equalToSuperview().inset(16) + } + } + + func configureUI() { + view.backgroundColor = .systemBackground + } + + func bind() { + messageTextField.rx.text + .withUnretained(self) + .subscribe { owner, message in + owner.errorMessage.label.attributedText = .makeStyledString(font: .b_s_r, text: message, color: .error900) + } + .disposed(by: disposeBag) + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/GuideAlertTestViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/GuideAlertTestViewController.swift new file mode 100644 index 00000000..2271e12e --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/GuideAlertTestViewController.swift @@ -0,0 +1,105 @@ +import UIKit + +import MLSDesignSystem + +import RxCocoa +import RxSwift +import SnapKit + +final class GuideAlertTestViewController: UIViewController { + // MARK: - Properties + var disposeBag = DisposeBag() + + let oneButton = CommonButton(style: .normal, title: "oneButtonModal", disabledTitle: nil) + let twoButton = CommonButton(style: .normal, title: "twoButtonModal", disabledTitle: nil) + let logoutButton = CommonButton(style: .normal, title: "logoutButtonModal", disabledTitle: nil) + let withdrawButton = CommonButton(style: .normal, title: "withdrawButtonModal", disabledTitle: nil) + + init() { + super.init(nibName: nil, bundle: nil) + self.title = "GuideAlert" + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Life Cycle +extension GuideAlertTestViewController { + override func viewDidLoad() { + super.viewDidLoad() + + addViews() + setupConstraints() + configureUI() + bind() + } +} + +// MARK: - SetUp +private extension GuideAlertTestViewController { + func addViews() { + view.addSubview(oneButton) + view.addSubview(twoButton) + view.addSubview(logoutButton) + view.addSubview(withdrawButton) + } + + func setupConstraints() { + oneButton.snp.makeConstraints { make in + make.bottom.equalToSuperview().inset(16) + make.centerX.equalToSuperview() + } + + twoButton.snp.makeConstraints { make in + make.bottom.equalTo(oneButton.snp.top).offset(-16) + make.centerX.equalToSuperview() + } + + logoutButton.snp.makeConstraints { make in + make.bottom.equalTo(twoButton.snp.top).offset(-16) + make.centerX.equalToSuperview() + } + + withdrawButton.snp.makeConstraints { make in + make.bottom.equalTo(logoutButton.snp.top).offset(-16) + make.centerX.equalToSuperview() + } + } + + func configureUI() { + view.backgroundColor = .systemBackground + } + + func bind() { + oneButton.rx.tap + .withUnretained(self) + .subscribe { _, _ in + GuideAlertFactory.show(mainText: "버튼 하나", ctaText: "확인", ctaAction: {}) + } + .disposed(by: disposeBag) + + twoButton.rx.tap + .withUnretained(self) + .subscribe { _, _ in + GuideAlertFactory.show(mainText: "버튼 두개", ctaText: "확인", cancelText: "취소", ctaAction: {}) + } + .disposed(by: disposeBag) + + logoutButton.rx.tap + .withUnretained(self) + .subscribe { _, _ in + GuideAlertFactory.showAuthAlert(type: .logout, ctaAction: {}) + } + .disposed(by: disposeBag) + + withdrawButton.rx.tap + .withUnretained(self) + .subscribe { _, _ in + GuideAlertFactory.showAuthAlert(type: .withdraw, ctaAction: {}) + } + .disposed(by: disposeBag) + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/HeaderTestViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/HeaderTestViewController.swift new file mode 100644 index 00000000..38fdaa4c --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/HeaderTestViewController.swift @@ -0,0 +1,157 @@ +import UIKit + +import MLSDesignSystem + +import RxCocoa +import RxSwift +import SnapKit + +final class HeaderTestViewController: UIViewController { + + // MARK: - Properties + var disposeBag = DisposeBag() + private let mainHeader = Header(style: .main, title: "메인") + private let filterHeader = Header(style: .filter, title: "필터") + + private let typeSegmentControl: UISegmentedControl = { + let items = ["main", "filter"] + let control = UISegmentedControl(items: items) + control.selectedSegmentIndex = 0 + return control + }() + + private let mainTextTextField: UITextField = { + let view = UITextField() + view.placeholder = "text" + view.text = "text" + view.layer.borderColor = UIColor.gray.cgColor + view.layer.borderWidth = 1 + return view + }() + + private let mainTextTextLabel: UILabel = { + let label = UILabel() + label.text = "text" + return label + }() + + private let filterTextTextField: UITextField = { + let view = UITextField() + view.placeholder = "text" + view.text = "text" + view.layer.borderColor = UIColor.gray.cgColor + view.layer.borderWidth = 1 + return view + }() + + private let filterTextTextLabel: UILabel = { + let label = UILabel() + label.text = "text" + return label + }() + + init() { + super.init(nibName: nil, bundle: nil) + self.title = "Header" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Life Cycle +extension HeaderTestViewController { + override func viewDidLoad() { + super.viewDidLoad() + + addViews() + setupConstraints() + configureUI() + bind() + } +} + +// MARK: - SetUp +private extension HeaderTestViewController { + func addViews() { + view.addSubview(mainHeader) + view.addSubview(filterHeader) + view.addSubview(typeSegmentControl) + view.addSubview(mainTextTextLabel) + view.addSubview(mainTextTextField) + view.addSubview(filterTextTextLabel) + view.addSubview(filterTextTextField) + } + + func setupConstraints() { + mainHeader.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).inset(16) + make.horizontalEdges.equalToSuperview().inset(16) + } + + filterHeader.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).inset(16) + make.horizontalEdges.equalToSuperview().inset(16) + } + + typeSegmentControl.snp.makeConstraints { make in + make.top.equalTo(mainHeader.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + mainTextTextLabel.snp.makeConstraints { make in + make.top.equalTo(typeSegmentControl.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + mainTextTextField.snp.makeConstraints { make in + make.top.equalTo(mainTextTextLabel.snp.bottom).offset(10) + make.horizontalEdges.equalToSuperview().inset(16) + } + + filterTextTextLabel.snp.makeConstraints { make in + make.top.equalTo(mainTextTextField.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + filterTextTextField.snp.makeConstraints { make in + make.top.equalTo(filterTextTextLabel.snp.bottom).offset(10) + make.horizontalEdges.equalToSuperview().inset(16) + } + } + + func configureUI() { + self.view.backgroundColor = .systemBackground + } + + func bind() { + typeSegmentControl.rx.selectedSegmentIndex + .withUnretained(self) + .subscribe { owner, selectedIndex in + switch selectedIndex { + case 0: + owner.mainHeader.isHidden = false + owner.filterHeader.isHidden = true + default: + owner.mainHeader.isHidden = true + owner.filterHeader.isHidden = false + } + } + .disposed(by: disposeBag) + + mainTextTextField.rx.text + .withUnretained(self) + .subscribe { (owner, text) in + owner.mainHeader.titleLabel.attributedText = .makeStyledString(font: owner.mainHeader.style.titleFont, text: text) + } + .disposed(by: disposeBag) + + filterTextTextField.rx.text + .withUnretained(self) + .subscribe { (owner, text) in + owner.filterHeader.titleLabel.attributedText = .makeStyledString(font: owner.filterHeader.style.titleFont, text: text) + } + .disposed(by: disposeBag) + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/InputBoxTextViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/InputBoxTextViewController.swift new file mode 100644 index 00000000..32db74b4 --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/InputBoxTextViewController.swift @@ -0,0 +1,179 @@ +import UIKit + +import MLSDesignSystem + +import RxCocoa +import RxSwift +import SnapKit + +final class InputBoxTextViewController: UIViewController { + // MARK: - Properties + private var disposeBag = DisposeBag() + private var inputBox = InputBox(label: "label", placeHodler: "placeHolder") + + private let typeSegmentControl: UISegmentedControl = { + let items = ["edit", "error"] + let control = UISegmentedControl(items: items) + control.selectedSegmentIndex = 0 + return control + }() + + private let labelTextField: UITextField = { + let view = UITextField() + view.placeholder = "label" + view.text = "label" + view.layer.borderColor = UIColor.gray.cgColor + view.layer.borderWidth = 1 + return view + }() + + private let placeHolderTextField: UITextField = { + let view = UITextField() + view.placeholder = "placeHolder" + view.text = "placeHolder" + view.layer.borderColor = UIColor.gray.cgColor + view.layer.borderWidth = 1 + return view + }() + + private let textTextField: UITextField = { + let view = UITextField() + view.placeholder = "text" + view.text = "text" + view.layer.borderColor = UIColor.gray.cgColor + view.layer.borderWidth = 1 + return view + }() + + private let labelTextLabel: UILabel = { + let label = UILabel() + label.text = "label" + return label + }() + + private let placeHolderTextLabel: UILabel = { + let label = UILabel() + label.text = "placeHolder" + return label + }() + + private let textTextLabel: UILabel = { + let label = UILabel() + label.text = "text" + return label + }() + + init() { + super.init(nibName: nil, bundle: nil) + self.title = "InputBox" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} + +// MARK: - Life Cycle +extension InputBoxTextViewController { + override func viewDidLoad() { + super.viewDidLoad() + self.addViews() + self.setupConstraints() + self.configureUI() + self.bind() + } +} + +// MARK: - SetUp +private extension InputBoxTextViewController { + func addViews() { + view.addSubview(inputBox) + view.addSubview(typeSegmentControl) + view.addSubview(labelTextLabel) + view.addSubview(labelTextField) + view.addSubview(placeHolderTextLabel) + view.addSubview(placeHolderTextField) + view.addSubview(textTextLabel) + view.addSubview(textTextField) + } + + func setupConstraints() { + inputBox.snp.makeConstraints { make in + make.horizontalEdges.top.equalTo(view.safeAreaLayoutGuide).inset(16) + } + + typeSegmentControl.snp.makeConstraints { make in + make.top.equalTo(inputBox.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + labelTextLabel.snp.makeConstraints { make in + make.top.equalTo(typeSegmentControl.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + labelTextField.snp.makeConstraints { make in + make.top.equalTo(labelTextLabel.snp.bottom).offset(10) + make.horizontalEdges.equalToSuperview().inset(16) + } + + placeHolderTextLabel.snp.makeConstraints { make in + make.top.equalTo(labelTextField.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + placeHolderTextField.snp.makeConstraints { make in + make.top.equalTo(placeHolderTextLabel.snp.bottom).offset(10) + make.horizontalEdges.equalToSuperview().inset(16) + } + + textTextLabel.snp.makeConstraints { make in + make.top.equalTo(placeHolderTextField.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + textTextField.snp.makeConstraints { make in + make.top.equalTo(textTextLabel.snp.bottom).offset(10) + make.horizontalEdges.equalToSuperview().inset(16) + } + } + + func configureUI() { + view.backgroundColor = .systemBackground + } + + func bind() { + typeSegmentControl.rx.selectedSegmentIndex + .withUnretained(self) + .subscribe { (owner, index) in + if index == 0 { + owner.inputBox.setType(type: .edit) + } else { + owner.inputBox.setType(type: .error) + } + } + .disposed(by: disposeBag) + + labelTextField.rx.text + .withUnretained(self) + .subscribe { owner, text in + owner.inputBox.label.attributedText = .makeStyledString(font: .b_s_r, text: text, color: .neutral700, alignment: .left) + } + .disposed(by: disposeBag) + + placeHolderTextField.rx.text + .withUnretained(self) + .subscribe { owner, text in + owner.inputBox.textField.attributedPlaceholder = .makeStyledString(font: .b_m_r, text: text, color: .neutral500, alignment: .left) + } + .disposed(by: disposeBag) + + textTextField.rx.text + .withUnretained(self) + .subscribe { (owner, text) in + owner.inputBox.textField.attributedText = .makeStyledString(font: .b_m_r, text: text, alignment: .left) + } + .disposed(by: disposeBag) + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/NavigationBarTestViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/NavigationBarTestViewController.swift new file mode 100644 index 00000000..04f48dc1 --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/NavigationBarTestViewController.swift @@ -0,0 +1,99 @@ +import UIKit + +import MLSDesignSystem + +import RxCocoa +import RxSwift +import SnapKit + +final class NavigationBarTestViewController: UIViewController { + + // MARK: - Properties + var disposeBag = DisposeBag() + + private let headerView1: NavigationBar = { + let view = NavigationBar(type: .withUnderLine("null")) + return view + }() + + private let headerView2: NavigationBar = { + let view = NavigationBar(type: .arrowRightLeft) + return view + }() + + private let headerView3: NavigationBar = { + let view = NavigationBar(type: .arrowLeft) + return view + }() + + private let headerView4: NavigationBar = { + let view = NavigationBar(type: .withString("null")) + return view + }() + + private let headerView5: NavigationBar = { + let view = NavigationBar(type: .collection("컬렉션 이름")) + return view + }() + + init() { + super.init(nibName: nil, bundle: nil) + self.title = "NavigationBar" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Life Cycle +extension NavigationBarTestViewController { + override func viewDidLoad() { + super.viewDidLoad() + + addViews() + setupConstraints() + configureUI() + } +} + +// MARK: - SetUp +private extension NavigationBarTestViewController { + func addViews() { + view.addSubview(headerView1) + view.addSubview(headerView2) + view.addSubview(headerView3) + view.addSubview(headerView4) + view.addSubview(headerView5) + } + + func setupConstraints() { + headerView1.snp.makeConstraints { make in + make.top.horizontalEdges.equalTo(view.safeAreaLayoutGuide) + } + + headerView2.snp.makeConstraints { make in + make.top.equalTo(headerView1.snp.bottom).offset(16) + make.horizontalEdges.equalTo(view.safeAreaLayoutGuide) + } + + headerView3.snp.makeConstraints { make in + make.top.equalTo(headerView2.snp.bottom).offset(16) + make.horizontalEdges.equalTo(view.safeAreaLayoutGuide) + } + + headerView4.snp.makeConstraints { make in + make.top.equalTo(headerView3.snp.bottom).offset(16) + make.horizontalEdges.equalTo(view.safeAreaLayoutGuide) + } + + headerView5.snp.makeConstraints { make in + make.top.equalTo(headerView4.snp.bottom).offset(16) + make.horizontalEdges.equalTo(view.safeAreaLayoutGuide) + } + } + + func configureUI() { + view.backgroundColor = .systemBackground + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/SearchBarTestViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/SearchBarTestViewController.swift new file mode 100644 index 00000000..e1d5b1c7 --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/SearchBarTestViewController.swift @@ -0,0 +1,61 @@ +import UIKit + +import MLSDesignSystem + +import RxCocoa +import RxSwift +import SnapKit + +final class SearchBarTestViewController: UIViewController { + + // MARK: - Properties + var disposeBag = DisposeBag() + + let searchBar: SearchBar = SearchBar() + + init() { + super.init(nibName: nil, bundle: nil) + self.title = "SearchBar" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Life Cycle +extension SearchBarTestViewController { + override func viewDidLoad() { + super.viewDidLoad() + + self.addViews() + self.setupConstraints() + self.configureUI() + } +} + +// MARK: - SetUp +private extension SearchBarTestViewController { + func addViews() { + view.addSubview(searchBar) + } + + func setupConstraints() { + searchBar.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).inset(16) + make.horizontalEdges.equalToSuperview() + } + } + + func configureUI() { + self.view.backgroundColor = .systemBackground + let tapGesture = UITapGestureRecognizer() + view.addGestureRecognizer(tapGesture) + + tapGesture.rx.event + .bind { [weak self] _ in + self?.view.endEditing(true) + } + .disposed(by: disposeBag) + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/SnackBarTestViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/SnackBarTestViewController.swift new file mode 100644 index 00000000..e11ba7b1 --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/SnackBarTestViewController.swift @@ -0,0 +1,61 @@ +import UIKit + +import MLSDesignSystem + +import RxSwift +import SnapKit + +final class SnackBarTestViewController: UIViewController { + + // MARK: - Properties + var disposeBag = DisposeBag() + + let normalSnackBar = SnackBar(type: .normal, image: DesignSystemAsset.image(named: "appleLogo"), imageBackgroundColor: .listNPC, text: "제목제목", buttonText: "되돌리기", buttonAction: nil) + + let deleteSnackBar = SnackBar(type: .delete, image: DesignSystemAsset.image(named: "testImage"), imageBackgroundColor: .listNPC, text: "제목제목", buttonText: "되돌리기", buttonAction: nil) + + init() { + super.init(nibName: nil, bundle: nil) + self.title = "SnackBar" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Life Cycle +extension SnackBarTestViewController { + override func viewDidLoad() { + super.viewDidLoad() + + addViews() + setupConstraints() + configureUI() + } +} + +// MARK: - SetUp +private extension SnackBarTestViewController { + func addViews() { + view.addSubview(normalSnackBar) + view.addSubview(deleteSnackBar) + } + + func setupConstraints() { + normalSnackBar.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).inset(16) + make.centerX.equalToSuperview() + } + + deleteSnackBar.snp.makeConstraints { make in + make.top.equalTo(normalSnackBar.snp.bottom).offset(16) + make.centerX.equalToSuperview() + } + } + + func configureUI() { + self.view.backgroundColor = .systemBackground + + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/StepIndicatorTestViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/StepIndicatorTestViewController.swift new file mode 100644 index 00000000..8405be63 --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/StepIndicatorTestViewController.swift @@ -0,0 +1,70 @@ +import UIKit + +import MLSDesignSystem + +import RxSwift +import SnapKit + +final class StepIndicatorTestViewController: UIViewController { + + // MARK: - Properties + var disposeBag = DisposeBag() + + let firstIndicator = StepIndicator(circleCount: 3) + let secondIndicator = StepIndicator(circleCount: 3) + let thirdIndicator = StepIndicator(circleCount: 3) + + init() { + super.init(nibName: nil, bundle: nil) + self.title = "StepIndicator" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Life Cycle +extension StepIndicatorTestViewController { + override func viewDidLoad() { + super.viewDidLoad() + + addViews() + setupConstraints() + configureUI() + } +} + +// MARK: - SetUp +private extension StepIndicatorTestViewController { + func addViews() { + view.addSubview(firstIndicator) + view.addSubview(secondIndicator) + view.addSubview(thirdIndicator) + } + + func setupConstraints() { + firstIndicator.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).offset(16) + make.centerX.equalToSuperview() + } + + secondIndicator.snp.makeConstraints { make in + make.top.equalTo(firstIndicator.snp.bottom).offset(16) + make.centerX.equalToSuperview() + } + + thirdIndicator.snp.makeConstraints { make in + make.top.equalTo(secondIndicator.snp.bottom).offset(16) + make.centerX.equalToSuperview() + } + } + + func configureUI() { + view.backgroundColor = .systemBackground + + firstIndicator.selectIndicator(index: 0) + secondIndicator.selectIndicator(index: 1) + thirdIndicator.selectIndicator(index: 2) + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/TagChipTestViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/TagChipTestViewController.swift new file mode 100644 index 00000000..4890c6d1 --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/TagChipTestViewController.swift @@ -0,0 +1,157 @@ +import UIKit + +import MLSDesignSystem + +import RxCocoa +import RxSwift +import SnapKit + +final class TagChipTestViewController: UIViewController { + + // MARK: - Properties + var disposeBag = DisposeBag() + private let normalTagChip = TagChip(style: .normal, text: "text") + private let searchTagChip = TagChip(style: .search, text: "text") + + private let typeSegmentControl: UISegmentedControl = { + let items = ["normal", "search"] + let control = UISegmentedControl(items: items) + control.selectedSegmentIndex = 0 + return control + }() + + private let normalTextLabel: UILabel = { + let label = UILabel() + label.text = "normal" + return label + }() + + private let normalTextField: UITextField = { + let view = UITextField() + view.placeholder = "text" + view.text = "text" + view.layer.borderColor = UIColor.gray.cgColor + view.layer.borderWidth = 1 + return view + }() + + private let searchTextLabel: UILabel = { + let label = UILabel() + label.text = "search" + return label + }() + + private let searchTextField: UITextField = { + let view = UITextField() + view.placeholder = "text" + view.text = "text" + view.layer.borderColor = UIColor.gray.cgColor + view.layer.borderWidth = 1 + return view + }() + + init() { + super.init(nibName: nil, bundle: nil) + title = "TagChip" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Life Cycle +extension TagChipTestViewController { + override func viewDidLoad() { + super.viewDidLoad() + + addViews() + setupConstraints() + configureUI() + bind() + } +} + +// MARK: - SetUp +private extension TagChipTestViewController { + func addViews() { + view.addSubview(normalTagChip) + view.addSubview(searchTagChip) + view.addSubview(typeSegmentControl) + view.addSubview(normalTextLabel) + view.addSubview(normalTextField) + view.addSubview(searchTextLabel) + view.addSubview(searchTextField) + } + + func setupConstraints() { + normalTagChip.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).inset(16) + make.centerX.equalToSuperview() + } + + searchTagChip.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).inset(16) + make.centerX.equalToSuperview() + } + + typeSegmentControl.snp.makeConstraints { make in + make.top.equalTo(normalTagChip.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + normalTextLabel.snp.makeConstraints { make in + make.top.equalTo(typeSegmentControl.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + normalTextField.snp.makeConstraints { make in + make.top.equalTo(normalTextLabel.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + searchTextLabel.snp.makeConstraints { make in + make.top.equalTo(normalTextField.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + + searchTextField.snp.makeConstraints { make in + make.top.equalTo(searchTextLabel.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + } + + func configureUI() { + view.backgroundColor = .systemBackground + } + + func bind() { + typeSegmentControl.rx.selectedSegmentIndex + .withUnretained(self) + .subscribe { owner, selectedIndex in + switch selectedIndex { + case 0: + owner.normalTagChip.isHidden = false + owner.searchTagChip.isHidden = true + default: + owner.normalTagChip.isHidden = true + owner.searchTagChip.isHidden = false + } + } + .disposed(by: disposeBag) + + normalTextField.rx.text.orEmpty + .withUnretained(self) + .subscribe { (owner, text) in + owner.normalTagChip.text = text + } + .disposed(by: disposeBag) + + searchTextField.rx.text.orEmpty + .withUnretained(self) + .subscribe { (owner, text) in + owner.searchTagChip.text = text + } + .disposed(by: disposeBag) + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/TapButtonTestViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/TapButtonTestViewController.swift new file mode 100644 index 00000000..235b113d --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/TapButtonTestViewController.swift @@ -0,0 +1,70 @@ +import UIKit + +import MLSDesignSystem + +import RxCocoa +import RxSwift +import SnapKit + +final class TapButtonTestViewController: UIViewController { + + // MARK: - Properties + var disposeBag = DisposeBag() + private let tapButton = TapButton(text: "text") + + private let buttonStateToggle = ToggleBox(text: "isSelected") + + init() { + super.init(nibName: nil, bundle: nil) + self.title = "TapButton" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Life Cycle +extension TapButtonTestViewController { + override func viewDidLoad() { + super.viewDidLoad() + + addViews() + setupConstraints() + configureUI() + bind() + } +} + +// MARK: - SetUp +private extension TapButtonTestViewController { + func addViews() { + view.addSubview(tapButton) + view.addSubview(buttonStateToggle) + } + + func setupConstraints() { + tapButton.snp.makeConstraints { make in + make.top.equalTo(view.safeAreaLayoutGuide).inset(16) + make.centerX.equalToSuperview() + } + + buttonStateToggle.snp.makeConstraints { make in + make.top.equalTo(tapButton.snp.bottom).offset(30) + make.horizontalEdges.equalToSuperview().inset(16) + } + } + + func configureUI() { + view.backgroundColor = .systemBackground + } + + func bind() { + buttonStateToggle.toggle.rx.isOn + .withUnretained(self) + .subscribe { (owner, isOn) in + owner.tapButton.isSelected = isOn + } + .disposed(by: disposeBag) + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/TextButtonTestViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/TextButtonTestViewController.swift new file mode 100644 index 00000000..18ec11c8 --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/TextButtonTestViewController.swift @@ -0,0 +1,47 @@ +import UIKit + +import MLSDesignSystem + +import RxSwift +import SnapKit + +final class TextButtonTestViewController: UIViewController { + + // MARK: - Properties + var disposeBag = DisposeBag() + + let button = TextButton() + + init() { + super.init(nibName: nil, bundle: nil) + self.title = "TextButton" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Life Cycle +extension TextButtonTestViewController { + override func viewDidLoad() { + super.viewDidLoad() + + view.backgroundColor = .whiteMLS + addViews() + setupConstraints() + } +} + +// MARK: - SetUp +private extension TextButtonTestViewController { + func addViews() { + view.addSubview(button) + } + + func setupConstraints() { + button.snp.makeConstraints { make in + make.center.equalToSuperview() + } + } +} diff --git a/MLS/MLSDesignSystemExample/ComponentsTest/ToastMakerTestViewController.swift b/MLS/MLSDesignSystemExample/ComponentsTest/ToastMakerTestViewController.swift new file mode 100644 index 00000000..0c52b17f --- /dev/null +++ b/MLS/MLSDesignSystemExample/ComponentsTest/ToastMakerTestViewController.swift @@ -0,0 +1,47 @@ +import UIKit + +import MLSDesignSystem + +import RxSwift +import SnapKit + +final class ToastMakerTestViewController: UIViewController { + + // MARK: - Properties + var disposeBag = DisposeBag() + + let toast = Toast(message: "토스트 테스트") + + init() { + super.init(nibName: nil, bundle: nil) + self.title = "Toast" + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Life Cycle +extension ToastMakerTestViewController { + override func viewDidLoad() { + super.viewDidLoad() + + view.backgroundColor = .whiteMLS + addViews() + setupConstraints() + } +} + +// MARK: - SetUp +private extension ToastMakerTestViewController { + func addViews() { + view.addSubview(toast) + } + + func setupConstraints() { + toast.snp.makeConstraints { make in + make.center.equalToSuperview() + } + } +} diff --git a/MLS/MLSDesignSystemExample/Info.plist b/MLS/MLSDesignSystemExample/Info.plist new file mode 100644 index 00000000..0eb786dc --- /dev/null +++ b/MLS/MLSDesignSystemExample/Info.plist @@ -0,0 +1,23 @@ + + + + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + + + + + + diff --git a/MLS/MLSDesignSystemExample/ViewController.swift b/MLS/MLSDesignSystemExample/ViewController.swift new file mode 100644 index 00000000..7651950d --- /dev/null +++ b/MLS/MLSDesignSystemExample/ViewController.swift @@ -0,0 +1,111 @@ +import UIKit + +import MLSDesignSystem + +import RxCocoa +import RxSwift +import SnapKit + +class ViewController: UIViewController { + let tableView: UITableView = { + let view = UITableView(frame: .zero, style: .plain) + return view + }() + + let bottomTabBarViewController = BottomTabBarController(viewControllers: [ + CheckBoxButtonTestViewController(), + NavigationBarTestViewController(), + CommonButtonTestViewController(), + InputBoxTextViewController() + ], initialIndex: 1) + + lazy var componentViews: [UIViewController] = [ + CheckBoxButtonTestViewController(), + NavigationBarTestViewController(), + CommonButtonTestViewController(), + InputBoxTextViewController(), + DropDownBoxTextViewController(), + ToastMakerTestViewController(), + ErrorMessageTextViewController(), + StepIndicatorTestViewController(), + HeaderTestViewController(), + TapButtonTestViewController(), + TagChipTestViewController(), + GuideAlertTestViewController(), + CardListTestViewController(), + bottomTabBarViewController, + SearchBarTestViewController(), + CollectionListTestViewController(), + SnackBarTestViewController(), + BadgeTestController(), + DictionaryDetailViewTestController(), + TextButtonTestViewController() + ] + + override func viewDidLoad() { + super.viewDidLoad() + self.view.backgroundColor = .systemBackground + tableView.dataSource = self + tableView.delegate = self + navigationItem.title = "MLS Design System" + bottomTabBarViewController.title = "BottomTabBar" + + view.addSubview(tableView) + tableView.snp.makeConstraints { make in + make.edges.equalTo(view.safeAreaLayoutGuide) + } + } +} + +extension ViewController: UITableViewDataSource, UITableViewDelegate { + func numberOfSections(in tableView: UITableView) -> Int { + return 2 + } + + func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + switch section { + case 0: + return "Components" + default: + return nil + } + } + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + switch section { + case 0: + return componentViews.count + default: + return 0 + } + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = UITableViewCell() + let viewController: UIViewController + + switch indexPath.section { + case 0: + viewController = componentViews[indexPath.row] + default: + return cell + } + + cell.textLabel?.text = viewController.title + cell.selectionStyle = .none + return cell + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let nextController: UIViewController + + switch indexPath.section { + case 0: + nextController = componentViews[indexPath.row] + default: + return + } + + navigationController?.pushViewController(nextController, animated: true) + } +} diff --git a/MLS/Presentation/AuthFeature/AuthFeature/Login/LoginView.swift b/MLS/Presentation/AuthFeature/AuthFeature/Login/LoginView.swift index b6f1aad4..f6f1fa32 100644 --- a/MLS/Presentation/AuthFeature/AuthFeature/Login/LoginView.swift +++ b/MLS/Presentation/AuthFeature/AuthFeature/Login/LoginView.swift @@ -67,7 +67,7 @@ final class LoginView: UIView { }() private let appleLogoImageView: UIImageView = { - let image = DesignSystemAsset.image(named: "AppleLogo") + let image = DesignSystemAsset.image(named: "appleLogo") let view = UIImageView(image: image) view.contentMode = .scaleAspectFit return view