Skip to content

Commit

Permalink
DealiSwitch 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
jalynneyoon committed Nov 9, 2023
1 parent 0d743ab commit 71b7eb5
Show file tree
Hide file tree
Showing 11 changed files with 305 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
042EA8C12A15AD5200370706 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 042EA8C02A15AD5200370706 /* MainView.swift */; };
04AD45132A15EF4400093BEB /* TypographyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD45122A15EF4400093BEB /* TypographyViewController.swift */; };
04AD45152A15EF5900093BEB /* TypographyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04AD45142A15EF5900093BEB /* TypographyView.swift */; };
4D1FA9292AFC778E00AA510F /* SwitchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D1FA9282AFC778E00AA510F /* SwitchViewController.swift */; };
4D5326D52AB15FFF00A9509A /* ButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D5326D42AB15FFF00A9509A /* ButtonViewController.swift */; };
4DB2D6F42AFB281100DFF053 /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DB2D6F32AFB281100DFF053 /* File.swift */; };
4DB2D6F42AFB281100DFF053 /* BottomSheetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DB2D6F32AFB281100DFF053 /* BottomSheetViewController.swift */; };
5A1E6B7D2AE68B270048D751 /* ChipViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A1E6B7C2AE68B270048D751 /* ChipViewController.swift */; };
E6EA11A42A8A24DC00ACCF3B /* AlertTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6EA11A32A8A24DC00ACCF3B /* AlertTestViewController.swift */; };
FC52E5FF2AA0315B00CADB39 /* RadioButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC52E5FE2AA0315B00CADB39 /* RadioButtonViewController.swift */; };
Expand All @@ -39,8 +40,9 @@
042EA8C02A15AD5200370706 /* MainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = "<group>"; };
04AD45122A15EF4400093BEB /* TypographyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypographyViewController.swift; sourceTree = "<group>"; };
04AD45142A15EF5900093BEB /* TypographyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TypographyView.swift; sourceTree = "<group>"; };
4D1FA9282AFC778E00AA510F /* SwitchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwitchViewController.swift; sourceTree = "<group>"; };
4D5326D42AB15FFF00A9509A /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = "<group>"; };
4DB2D6F32AFB281100DFF053 /* File.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = "<group>"; };
4DB2D6F32AFB281100DFF053 /* BottomSheetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottomSheetViewController.swift; sourceTree = "<group>"; };
5A1E6B7C2AE68B270048D751 /* ChipViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChipViewController.swift; sourceTree = "<group>"; };
E6EA11A32A8A24DC00ACCF3B /* AlertTestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertTestViewController.swift; sourceTree = "<group>"; };
FC52E5FE2AA0315B00CADB39 /* RadioButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtonViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -101,14 +103,8 @@
04AD450F2A15EEF900093BEB /* ViewControllers */ = {
isa = PBXGroup;
children = (
4DB2D6F32AFB281100DFF053 /* File.swift */,
FC52E5FE2AA0315B00CADB39 /* RadioButtonViewController.swift */,
042EA8AC2A14C7D500370706 /* MainViewController.swift */,
04AD45122A15EF4400093BEB /* TypographyViewController.swift */,
041ABC0B2A175E19001772F3 /* ColorViewController.swift */,
E6EA11A32A8A24DC00ACCF3B /* AlertTestViewController.swift */,
4D5326D42AB15FFF00A9509A /* ButtonViewController.swift */,
5A1E6B7C2AE68B270048D751 /* ChipViewController.swift */,
4D1FA9272AFC740000AA510F /* Sub */,
);
path = ViewControllers;
sourceTree = "<group>";
Expand All @@ -133,6 +129,21 @@
path = Others;
sourceTree = "<group>";
};
4D1FA9272AFC740000AA510F /* Sub */ = {
isa = PBXGroup;
children = (
5A1E6B7C2AE68B270048D751 /* ChipViewController.swift */,
4D5326D42AB15FFF00A9509A /* ButtonViewController.swift */,
E6EA11A32A8A24DC00ACCF3B /* AlertTestViewController.swift */,
041ABC0B2A175E19001772F3 /* ColorViewController.swift */,
04AD45122A15EF4400093BEB /* TypographyViewController.swift */,
FC52E5FE2AA0315B00CADB39 /* RadioButtonViewController.swift */,
4DB2D6F32AFB281100DFF053 /* BottomSheetViewController.swift */,
4D1FA9282AFC778E00AA510F /* SwitchViewController.swift */,
);
path = Sub;
sourceTree = "<group>";
};
FCEC04882A72B9A60004E5DB /* Packages */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -222,7 +233,7 @@
buildActionMask = 2147483647;
files = (
042EA8AD2A14C7D500370706 /* MainViewController.swift in Sources */,
4DB2D6F42AFB281100DFF053 /* File.swift in Sources */,
4DB2D6F42AFB281100DFF053 /* BottomSheetViewController.swift in Sources */,
04AD45132A15EF4400093BEB /* TypographyViewController.swift in Sources */,
041ABC0C2A175E19001772F3 /* ColorViewController.swift in Sources */,
E6EA11A42A8A24DC00ACCF3B /* AlertTestViewController.swift in Sources */,
Expand All @@ -232,6 +243,7 @@
5A1E6B7D2AE68B270048D751 /* ChipViewController.swift in Sources */,
042EA8AB2A14C7D500370706 /* SceneDelegate.swift in Sources */,
04AD45152A15EF5900093BEB /* TypographyView.swift in Sources */,
4D1FA9292AFC778E00AA510F /* SwitchViewController.swift in Sources */,
4D5326D52AB15FFF00A9509A /* ButtonViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,48 +21,63 @@ final class MainViewController: UIViewController {
self.navigationItem.backButtonTitle = "Home"
self.title = "iOS Design System Sample App"

let alertButton = DealiButton()
self.view.addSubview(alertButton)
alertButton.then {
$0.style = .medium(style: .filled)
$0.title = "Alert"
$0.addTarget(self, action: #selector(alertButtonPressed), for: .touchUpInside)
let scrollView = UIScrollView()
self.view.addSubview(scrollView)
scrollView.snp.makeConstraints {
$0.edges.equalToSuperview()
}

let contentView = UIView()
scrollView.addSubview(contentView)
contentView.snp.makeConstraints {
$0.edges.equalToSuperview()
$0.width.equalToSuperview()
}

let contentStackView = UIStackView()
contentView.addSubview(contentStackView)
contentStackView.then {
$0.axis = .vertical
$0.spacing = 20.0
}.snp.makeConstraints {
$0.top.equalToSuperview().offset(100.0)
$0.top.equalToSuperview().inset(30.0)
$0.left.right.equalToSuperview().inset(20.0)
$0.bottom.equalToSuperview()
}

let alertButton = DealiControl.btnOutlineLargeSecondary01()
contentStackView.addArrangedSubview(alertButton)
alertButton.do {
$0.title = "Alert"
$0.addTarget(self, action: #selector(alertButtonPressed), for: .touchUpInside)
}

let radioButton = DealiButton()
self.view.addSubview(radioButton)
radioButton.then {
$0.style = .medium(style: .filled)
let radioButton = DealiControl.btnOutlineLargeSecondary01()
contentStackView.addArrangedSubview(radioButton)
radioButton.do {
$0.title = "RadioButton"
$0.addTarget(self, action: #selector(radioButtonPressed), for: .touchUpInside)
}.snp.makeConstraints {
$0.top.equalTo(alertButton.snp.bottom).offset(20.0)
$0.left.right.equalToSuperview().inset(20.0)
}

let buttonComponentsButton = DealiButton()
self.view.addSubview(buttonComponentsButton)
buttonComponentsButton.then {
$0.style = .medium(style: .filled)
let buttonComponentsButton = DealiControl.btnOutlineLargeSecondary01()
contentStackView.addArrangedSubview(buttonComponentsButton)
buttonComponentsButton.do {
$0.title = "Button Components"
$0.addTarget(self, action: #selector(buttonComponentButtonPressed), for: .touchUpInside)
}.snp.makeConstraints {
$0.top.equalTo(radioButton.snp.bottom).offset(20.0)
$0.left.right.equalToSuperview().inset(20.0)
}

let chipComponentsButton = DealiButton()
self.view.addSubview(chipComponentsButton)
chipComponentsButton.then {
$0.style = .medium(style: .filled)
let chipComponentsButton = DealiControl.btnOutlineLargeSecondary01()
contentStackView.addArrangedSubview(chipComponentsButton)
chipComponentsButton.do {
$0.title = "Chip Components"
$0.addTarget(self, action: #selector(chipButtonPressed), for: .touchUpInside)
}.snp.makeConstraints {
$0.top.equalTo(buttonComponentsButton.snp.bottom).offset(20.0)
$0.left.right.equalToSuperview().inset(20.0)
}

let switchComponentButton = DealiControl.btnOutlineLargeSecondary01()
contentStackView.addArrangedSubview(switchComponentButton)
switchComponentButton.do {
$0.title = "Toggle/Switch"
$0.addTarget(self, action: #selector(toggleButtonPressed), for: .touchUpInside)
}

}
Expand Down Expand Up @@ -97,10 +112,10 @@ extension MainViewController {
}

@objc func chipButtonPressed() {
// self.navigationController?.pushViewController(ChipViewController(), animated: true)
let vc = MyViewController()
vc.modalTransitionStyle = .crossDissolve
vc.modalPresentationStyle = .overCurrentContext
self.present(vc, animated: true)
self.navigationController?.pushViewController(ChipViewController(), animated: true)
}

@objc func toggleButtonPressed() {
self.navigationController?.pushViewController(SwitchViewController(), animated: true)
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//
// File.swift
//
// BottomSheetViewController.swift
//
//
// Created by JohyeonYoon on 11/6/23.
//

import UIKit
import DealiDesignKit

class MyViewController: DealiBottomSheetViewController {
class BottomSheetViewController: DealiBottomSheetViewController {
override func loadView() {
super.loadView()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// SwitchViewController.swift
// DealiDesignSystemSampleApp
//
// Created by 윤조현 on 2023/11/09.
// Copyright © 2023 Dealicious Inc. All rights reserved.
//

import UIKit
import DealiDesignKit

final class SwitchViewController: UIViewController {
let enableSwitch = DealiSwitch()

override func loadView() {
self.view = .init()

self.view.backgroundColor = .systemBackground

self.view.addSubview(enableSwitch)
enableSwitch.style = .iosSystem
enableSwitch.addTarget(self, action: #selector(systemSwitchValueChanged), for: .valueChanged)
enableSwitch.snp.makeConstraints {
$0.center.equalToSuperview()
}

let disableOffSwitch = DealiSwitch()
self.view.addSubview(disableOffSwitch)
disableOffSwitch.then {
$0.isEnabled = false
}.snp.makeConstraints {
$0.centerX.equalToSuperview()
$0.top.equalTo(enableSwitch.snp.bottom).offset(20.0)
}


let disableOnSwitch = DealiSwitch(style: .andriodSystem)
self.view.addSubview(disableOnSwitch)
disableOnSwitch.then {
$0.setOn(false, animated: true)
}.snp.makeConstraints {
$0.centerX.equalToSuperview()
$0.top.equalTo(disableOffSwitch.snp.bottom).offset(20.0)
}
}

override func viewDidLoad() {
super.viewDidLoad()


}

@objc func systemSwitchValueChanged() {
print(self.enableSwitch.isOn)
}
}



Loading

0 comments on commit 71b7eb5

Please sign in to comment.