Skip to content

Commit

Permalink
feature: ErrorFeature Example 모듈과 두 에러뷰 UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Jihyun247 committed Nov 14, 2024
1 parent 619923e commit 3eb4e4f
Show file tree
Hide file tree
Showing 12 changed files with 232 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"images" : [
{
"filename" : "ICON_DEMO.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
<rect key="frame" x="0.0" y="832" width="393" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ErrorFeature 모듈 데모앱" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
<rect key="frame" x="0.0" y="263.66666666666669" width="393" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" constant="20" symbolic="YES" id="SfN-ll-jLj"/>
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" symbolic="YES" id="x7j-FC-K8j"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
34 changes: 34 additions & 0 deletions Projects/Feature/ErrorFeature/Example/Sources/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import SwiftUI

import ErrorFeature

struct ContentView: View {
@State var isNetworkErrorViewPresented = false
@State var isRequestErrorViewPresented = false

var body: some View {
VStack(spacing: 20) {
Spacer()

Button(title: "네트워크 에러 뷰") {
isNetworkErrorViewPresented = true
}

Button(title: "서버통신 에러 뷰") {
isRequestErrorViewPresented = true
}

Spacer()
}
.fullScreenCover(isPresented: $isNetworkErrorViewPresented) {
NetworkErrorView()
}
.fullScreenCover(isPresented: $isRequestErrorViewPresented) {
RequestErrorView()
}
}
}

#Preview {
ContentView()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import SwiftUI

@main
struct ErrorFeatureApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
3 changes: 2 additions & 1 deletion Projects/Feature/ErrorFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ let project: Project = .makeTMABasedProject(
targets: [
.sources,
.tests,
.testing
.testing,
.example
],
dependencies: [
.sources: [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//
// NetworkErrorView.swift
// ErrorFeature
//
// Created by 김지현 on 11/14/24.
// Copyright © 2024 PomoNyang. All rights reserved.
//

import SwiftUI

import DesignSystem

public struct NetworkErrorView: View {
@Environment(\.dismiss) var dismiss

public init() {

}

public var body: some View {
HStack {
Spacer()

VStack(spacing: Alias.Spacing.xxxLarge) {
Spacer()

DesignSystemAsset.Image.imgOnboarding1.swiftUIImage

VStack(spacing: Alias.Spacing.small) {
Text("인터넷 연결이 불안정해요")
.font(Typography.header4)
.foregroundStyle(Alias.Color.Text.primary)
Text("연결 상태를 확인한 후\n다시 시도해 주세요.")
.multilineTextAlignment(.center)
.font(Typography.bodyR)
.foregroundStyle(Alias.Color.Text.secondary)
}
.padding(.bottom, 34)

Button(title: "다시 시도하기") {
dismiss()
}
.buttonStyle(.box(level: .primary, size: .large, width: .medium))

Spacer()
}

Spacer()
}
.background(Alias.Color.Background.primary)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// RequestErrorView.swift
// ErrorFeature
//
// Created by 김지현 on 11/14/24.
// Copyright © 2024 PomoNyang. All rights reserved.
//

import SwiftUI

import DesignSystem

public struct RequestErrorView: View {
@Environment(\.dismiss) var dismiss

public init() {

}

public var body: some View {
HStack {
Spacer()

VStack(spacing: Alias.Spacing.xxxLarge) {
Spacer()

DesignSystemAsset.Image.imgOnboarding1.swiftUIImage

VStack(spacing: Alias.Spacing.small) {
Text("문제가 발생했어요")
.font(Typography.header4)
.foregroundStyle(Alias.Color.Text.primary)
Text("잠시 후에 다시 확인해주세요.\n문제가 지속된다면 고객센터에 문의해주세요.")
.multilineTextAlignment(.center)
.font(Typography.bodyR)
.foregroundStyle(Alias.Color.Text.secondary)
}
.padding(.bottom, 34)

VStack(spacing: Alias.Spacing.large) {
Button(title: "홈으로 이동") {
dismiss()
}
.buttonStyle(.box(level: .primary, size: .large, width: .medium))

Button(
action: {
print("고객센터 문의")
},
label: {
Text("고객센터 문의")
.font(Typography.bodyR)
.underline(pattern: .solid, color: Alias.Color.Text.tertiary)
.foregroundStyle(Alias.Color.Text.tertiary)
}
)
}

Spacer()
}

Spacer()
}
.background(Alias.Color.Background.primary)
}
}

0 comments on commit 3eb4e4f

Please sign in to comment.