Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

πŸ”€ :: 둜그인 νŽ˜μ΄μ§€ 타이틀 폰트 정상화 #177

Merged
merged 2 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public extension TargetDependency {
}

public extension TargetDependency.SPM {
static let Lottie = TargetDependency.external(name: "Lottie")
static let TagLayoutView = TargetDependency.external(name: "TagLayoutView")
static let NukeUI = TargetDependency.external(name: "NukeUI")
static let Needle = TargetDependency.external(name: "NeedleFoundation")
Expand Down
8 changes: 5 additions & 3 deletions Projects/Core/DesignSystem/Demo/Sources/DemoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ import DesignSystem
import SwiftUI

public struct DemoView: View {
@State var isShowing = false
@State var isLoading = false

public var body: some View {
VStack {
Button {
self.isShowing = true
withAnimation {
self.isLoading = true
}
} label: {
Text("A")
}
}
.smsToast(text: "ASDF", isShowing: $isShowing)
.smsLoading(isLoading: isLoading)
}
}

Expand Down
8 changes: 6 additions & 2 deletions Projects/Core/DesignSystem/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ let project = Project.makeModule(
product: .framework,
targets: [.demo],
externalDependencies: [
.SPM.TagLayoutView
.SPM.TagLayoutView,
.SPM.Lottie
],
internalDependencies: [
.Shared.ViewUtil
],
resources: ["Resources/**"]
resources: ["Resources/**"],
resourceSynthesizers: .default + [
.custom(name: "Lottie", parser: .json, extensions: ["json"])
]
)

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions Projects/Core/DesignSystem/Sources/Loading/SMSLoading.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import SwiftUI
import ViewUtil
import Lottie

public extension View {
func smsLoading(
Expand All @@ -13,17 +14,17 @@ struct SMSLoadingModifier: ViewModifier {
var isLoading: Bool

func body(content: Content) -> some View {
content
.overlay {
ZStack {
Color.sms(.neutral(.n40))
.opacity(0.3)
.ignoresSafeArea()
ZStack {
content

ProgressView()
.progressViewStyle(.circular)
}
.conditional(isLoading)
if isLoading {
Color.sms(.neutral(.n40))
.opacity(0.3)
.ignoresSafeArea()

LottieView(asset: AnimationAsset.smsLoading, contentMode: .scaleAspectFit)
.frame(width: 80, height: 80)
}
}
}
}
38 changes: 38 additions & 0 deletions Projects/Core/DesignSystem/Sources/Lottie/LottieView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import Lottie
import SwiftUI

public struct LottieView: UIViewRepresentable {
private let asset: AnimationAsset
private let loopMode: LottieLoopMode
private let contentMode: UIView.ContentMode

public init(
asset: AnimationAsset,
loopMode: LottieLoopMode = .loop,
contentMode: UIView.ContentMode = .scaleAspectFit
) {
self.asset = asset
self.loopMode = loopMode
self.contentMode = contentMode
}

public func makeUIView(context: Context) -> some UIView {
let lottieView = LottieAnimationView(
animation: AnimationAsset.smsLoading.animation
)
lottieView.translatesAutoresizingMaskIntoConstraints = false
lottieView.loopMode = loopMode
lottieView.contentMode = contentMode
lottieView.play()

let containerView = UIView(frame: .zero)
containerView.addSubview(lottieView)
NSLayoutConstraint.activate([
lottieView.heightAnchor.constraint(equalTo: containerView.heightAnchor),
lottieView.widthAnchor.constraint(equalTo: containerView.widthAnchor)
])
return containerView
}

public func updateUIView(_ uiView: UIViewType, context: Context) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct SigninView: View {
Text("STUDENT\nMANAGEMENT\nSERVICE")
.multilineTextAlignment(.center)
.padding(.top, 124)
.font(.sms(.headline1))
.font(.sms(.headline2))
.foregroundColor(.sms(.system(.white)))

Text("학생 정보 톡합관리 μ„œλΉ„μŠ€")
Expand Down
1 change: 1 addition & 0 deletions Tuist/Dependencies.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ let dependencies = Dependencies(
carthage: nil,
swiftPackageManager: SwiftPackageManagerDependencies(
[
.remote(url: "https://github.com/airbnb/lottie-ios.git", requirement: .exact("4.2.0")),
.remote(url: "https://github.com/giiiita/TagLayoutView.git", requirement: .branch("master")),
.remote(url: "https://github.com/kean/Nuke.git", requirement: .exact("12.1.0")),
.remote(url: "https://github.com/uber/needle", requirement: .exact("0.22.0")),
Expand Down
6 changes: 4 additions & 2 deletions Tuist/ProjectDescriptionHelpers/Project+Template.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public extension Project {
resources: ResourceFileElements? = nil,
settings: SettingsDictionary = [:],
additionalPlistRows: [String: ProjectDescription.InfoPlist.Value] = [:],
additionalFiles: [FileElement] = []
additionalFiles: [FileElement] = [],
resourceSynthesizers: [ResourceSynthesizer] = .default
) -> Project {
let scripts: [TargetScript] = isCI ? [] : [.swiftLint]
let ldFlagsSettings: SettingsDictionary = product == .framework ?
Expand Down Expand Up @@ -197,7 +198,8 @@ public extension Project {
packages: packages,
settings: settings,
targets: allTargets,
schemes: schemes
schemes: schemes,
resourceSynthesizers: resourceSynthesizers
)
}
}
Expand Down
56 changes: 56 additions & 0 deletions Tuist/ResourceSynthesizers/Lottie.stencil
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// swiftformat:disable all
// swiftlint:disable all
{% if files %}
{% set accessModifier %}{% if param.publicAccess %}public{% else %}internal{% endif %}{% endset %}
{% set documentPrefix %}{{param.documentName|default:"Document"}}{% endset %}
import Foundation
#if canImport(Lottie)
import Lottie
// MARK: - Animations Assets
{{accessModifier}} extension AnimationAsset {
{% for file in files %}
static let {{file.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}} = Self(named: "{{file.name}}")
{% endfor %}
}
// MARK: - Animation Helpers
{{accessModifier}} extension AnimationAsset {
/// All the available animation. Can be used to preload them
static let allAnimations: [Self] = [
{% for file in files %}
Self.{{file.name|swiftIdentifier:"pretty"|lowerFirstWord|escapeReservedKeywords}},
{% endfor %}
]
}
// MARK: - Structures
{{accessModifier}} struct AnimationAsset: Hashable {
{{accessModifier}} fileprivate(set) var name: String
{{accessModifier}} let animation: LottieAnimation?
{{accessModifier}} init(named name: String) {
self.name = name
if let url = Bundle.module.url(forResource: name, withExtension: "json") {
self.animation = LottieAnimation.filepath(url.path)
} else {
self.animation = nil
}
}
// MARK: Hashable Conformance
{{accessModifier}} static func == (lhs: Self, rhs: Self) -> Bool {
return lhs.name == rhs.name
}
{{accessModifier}} func hash(into hasher: inout Hasher) {
hasher.combine(self.name)
}
}
// MARK: - Preload Helpers
{{accessModifier}} extension AnimationAsset {
/// Preloads all the Lottie Animations to avoid performance issues when loading them
static func preload() -> Void {
for animationAsset in Self.allAnimations {
_ = animationAsset.animation
}
}
}
#endif
{% else %}
// No files found
{% endif %}