Skip to content

Commit

Permalink
[#1] Basic Custom View Session
Browse files Browse the repository at this point in the history
  • Loading branch information
Taehyeon-Kim committed May 5, 2022
1 parent 39f2f0a commit c1ff6c5
Show file tree
Hide file tree
Showing 51 changed files with 2,876 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added BasicCustomView/.DS_Store
Binary file not shown.
Binary file added BasicCustomView/Final/.DS_Store
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// AppDelegate.swift
// BasicCustomView
//
// Created by taehy.k on 2022/05/05.
//

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {



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

// MARK: UISceneSession Lifecycle

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

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// 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.
}


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// SceneDelegate.swift
// BasicCustomView
//
// Created by taehy.k on 2022/05/05.
//

import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?


func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let _ = (scene as? UIWindowScene) else { return }
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// BottomSheet.swift
// BasicCustomView
//
// Created by taehy.k on 2022/05/05.
//

import UIKit

class BottomSheet: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

}

@IBAction func showBottomSheetTapped(_ sender: Any) {
print("커스텀 바텀시트 띄우기")
guard let customBottomSheet = self.storyboard?.instantiateViewController(withIdentifier: "CustomBottomSheet") as? CustomBottomSheet else { return }
customBottomSheet.modalTransitionStyle = .crossDissolve
customBottomSheet.modalPresentationStyle = .overFullScreen
present(customBottomSheet, animated: false) {
customBottomSheet.showBottomSheetWithAnimation()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// CustomBottomSheet.swift
// BasicCustomView
//
// Created by taehy.k on 2022/05/05.
//

import UIKit

class CustomBottomSheet: UIViewController {

@IBOutlet weak var containerView: UIView!
@IBOutlet weak var containerHeight: NSLayoutConstraint!
@IBOutlet weak var itemStackView: UIStackView!

override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)
if let touch = touches.first,
touch.view == self.view {
hideBottomSheetWithAnimation()
}
}

private func setupUI() {
containerHeight.constant = 0
containerView.layer.cornerRadius = 12
containerView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner]
}

@IBAction func cancelButtonTapped(_ sender: Any) {
hideBottomSheetWithAnimation()
}
}

// MARK: - Show/Hide Animation
extension CustomBottomSheet {
func showBottomSheetWithAnimation() {
UIView.animate(withDuration: 0.3) {
self.containerHeight.constant = 330
self.view.layoutIfNeeded()
}
}

func hideBottomSheetWithAnimation() {
UIView.animate(withDuration: 0.3) {
self.containerHeight.constant = 0
self.view.layoutIfNeeded()
} completion: { _ in
self.dismiss(animated: false)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ZhK-L9-g7R">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Tab Bar Controller-->
<scene sceneID="CjD-DG-mJh">
<objects>
<tabBarController automaticallyAdjustsScrollViewInsets="NO" id="ZhK-L9-g7R" sceneMemberID="viewController">
<toolbarItems/>
<tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="FOM-IF-WnB">
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="selectedImageTintColor" red="0.32549019610000002" green="0.28235294119999998" blue="0.80784313730000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</tabBar>
<connections>
<segue destination="Npe-VN-PwX" kind="relationship" relationship="viewControllers" id="X51-eN-w9n"/>
<segue destination="ARI-yi-ty8" kind="relationship" relationship="viewControllers" id="vie-94-bGB"/>
<segue destination="Kjp-Tu-sjq" kind="relationship" relationship="viewControllers" id="K5p-x8-aIM"/>
</connections>
</tabBarController>
<placeholder placeholderIdentifier="IBFirstResponder" id="lMW-wi-kkf" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="111.59420289855073" y="115.84821428571428"/>
</scene>
<!--PopUp-->
<scene sceneID="ZQQ-MP-U1i">
<objects>
<viewControllerPlaceholder storyboardName="PopUp" id="Npe-VN-PwX" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Item" id="Uog-wr-6RE"/>
</viewControllerPlaceholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="TWL-AP-AeY" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="933" y="-109"/>
</scene>
<!--BottomSheet-->
<scene sceneID="bPZ-2V-yR7">
<objects>
<viewControllerPlaceholder storyboardName="BottomSheet" id="ARI-yi-ty8" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Item" id="fDK-Gx-4bS"/>
</viewControllerPlaceholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="hht-r8-HA8" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="917" y="70"/>
</scene>
<!--ViewPager-->
<scene sceneID="YPc-mM-pSD">
<objects>
<viewControllerPlaceholder storyboardName="ViewPager" id="Kjp-Tu-sjq" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Item" id="DK9-2X-byI"/>
</viewControllerPlaceholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="BWU-Lx-78T" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="917" y="252"/>
</scene>
</scenes>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// ViewController.swift
// BasicCustomView
//
// Created by taehy.k on 2022/05/05.
//

import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
Loading

0 comments on commit c1ff6c5

Please sign in to comment.