Skip to content

Commit 699b3c1

Browse files
committed
[Feat] 버전 0.1.0 릴리즈
0 parents  commit 699b3c1

24 files changed

+671
-0
lines changed

.gitignore

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/xcode,macos
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=xcode,macos
3+
4+
### macOS ###
5+
# General
6+
.DS_Store
7+
.AppleDouble
8+
.LSOverride
9+
10+
# Icon must end with two \r
11+
Icon
12+
13+
14+
# Thumbnails
15+
._*
16+
17+
# Files that might appear in the root of a volume
18+
.DocumentRevisions-V100
19+
.fseventsd
20+
.Spotlight-V100
21+
.TemporaryItems
22+
.Trashes
23+
.VolumeIcon.icns
24+
.com.apple.timemachine.donotpresent
25+
26+
# Directories potentially created on remote AFP share
27+
.AppleDB
28+
.AppleDesktop
29+
Network Trash Folder
30+
Temporary Items
31+
.apdisk
32+
33+
### macOS Patch ###
34+
# iCloud generated files
35+
*.icloud
36+
37+
### Xcode ###
38+
## User settings
39+
xcuserdata/
40+
41+
## Xcode 8 and earlier
42+
*.xcscmblueprint
43+
*.xccheckout
44+
45+
### Xcode Patch ###
46+
*.xcodeproj/*
47+
!*.xcodeproj/project.pbxproj
48+
!*.xcodeproj/xcshareddata/
49+
!*.xcodeproj/project.xcworkspace/
50+
!*.xcworkspace/contents.xcworkspacedata
51+
/*.gcno
52+
**/xcshareddata/WorkspaceSettings.xcsettings
53+
54+
# End of https://www.toptal.com/developers/gitignore/api/xcode,macos

.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// swift-tools-version:5.10
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "LodyExtensions",
8+
platforms: [
9+
.iOS(.v14)
10+
],
11+
products: [
12+
.library(
13+
name: "LodyExtensions",
14+
type: .static,
15+
targets: ["LodyExtensions"]),
16+
.library(
17+
name: "LodyExtensions-Dynamic",
18+
type: .dynamic,
19+
targets: ["LodyExtensions"]),
20+
],
21+
dependencies: [
22+
],
23+
targets: [
24+
.target(
25+
name: "LodyExtensions",
26+
dependencies: []),
27+
.testTarget(
28+
name: "LodyExtensionsTests",
29+
dependencies: ["LodyExtensions"]),
30+
],
31+
swiftLanguageVersions: [.v5]
32+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// Collection+Ex.swift
3+
//
4+
// Created by Lody on 5/8/24.
5+
//
6+
7+
import Foundation
8+
9+
public extension Array where Element: Equatable {
10+
/// 조건에 해당하는 요소가 없을 때만 추가
11+
mutating func appendIfNotExist(_ element: Element) {
12+
if !self.contains(element) {
13+
self.append(element)
14+
}
15+
}
16+
17+
/// 조건에 맞는 요소를 찾아 제거하고 맨 뒤로 이동
18+
mutating func popToBack(_ element: Element) {
19+
if let index = self.firstIndex(of: element) {
20+
self.remove(at: index)
21+
}
22+
self.append(element)
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// Double+Ex.swift
3+
4+
//
5+
// Created by Lody on 4/27/24.
6+
//
7+
8+
import Foundation
9+
10+
public extension Double {
11+
/// CGFloat으로 형변환
12+
var f: CGFloat {
13+
return CGFloat(self)
14+
}
15+
/// CGSize으로 형변환
16+
var sz: CGSize {
17+
return CGSize(width: self, height: self)
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// Int+Ex.swift
3+
//
4+
// Created by Lody on 4/27/24.
5+
//
6+
7+
import Foundation
8+
9+
public extension Int {
10+
/// CGFloat으로 형변환
11+
var f: CGFloat {
12+
return CGFloat(self)
13+
}
14+
15+
/// CGSize으로 형변환
16+
var sz: CGSize {
17+
return CGSize(width: self, height: self)
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// String+Ex.swift
3+
//
4+
// Created by Lody on 4/24/24.
5+
//
6+
7+
import Foundation
8+
9+
public extension String {
10+
/// URL로 변환
11+
func toURL() -> URL? {
12+
URL(string: self)
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//
2+
// View+alignment.swift
3+
//
4+
//
5+
// Created by 쩡화니 on 5/22/24.
6+
//
7+
8+
import SwiftUI
9+
10+
public extension View {
11+
/// 수평 정렬: leading
12+
func hLeading() -> some View {
13+
self.frame(maxWidth: .infinity, alignment: .leading)
14+
}
15+
16+
/// 수평 정렬: trailing
17+
func hTrailing() -> some View {
18+
self.frame(maxWidth: .infinity, alignment: .trailing)
19+
}
20+
21+
/// 수평 정렬: center
22+
func hCenter() -> some View {
23+
self.frame(maxWidth: .infinity, alignment: .center)
24+
}
25+
26+
/// 수직 정렬: top
27+
func vTop() -> some View {
28+
self.frame(maxHeight: .infinity, alignment: .top)
29+
}
30+
31+
/// 수직 정렬: bottom
32+
func vBottom() -> some View {
33+
self.frame(maxHeight: .infinity, alignment: .bottom)
34+
}
35+
36+
/// 수직 정렬: center
37+
func vCenter() -> some View {
38+
self.frame(maxHeight: .infinity, alignment: .center)
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// View+hideKeyboard.swift
3+
//
4+
//
5+
// Created by 쩡화니 on 5/22/24.
6+
//
7+
8+
import SwiftUI
9+
10+
public extension View {
11+
12+
/// View 주변 터치시 키보드 내리기
13+
func hideKeyboardWhenTappedAround() -> some View {
14+
return self.onTapGesture {
15+
UIApplication.shared.sendAction(
16+
#selector(UIResponder.resignFirstResponder),
17+
to: nil,
18+
from: nil,
19+
for: nil
20+
)
21+
}
22+
}
23+
24+
/// View 드래그시 키보드 내리기
25+
func hideKeyboardOnDrag() -> some View {
26+
return self.gesture(DragGesture().onChanged { _ in
27+
self.hideKeyboard()
28+
})
29+
}
30+
31+
/// 키보드 내리기
32+
func hideKeyboard() {
33+
let resign = #selector(UIResponder.resignFirstResponder)
34+
UIApplication.shared.sendAction(resign, to: nil, from: nil, for: nil)
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// View+onLoad.swift
3+
//
4+
//
5+
// Created by 쩡화니 on 5/22/24.
6+
//
7+
8+
import SwiftUI
9+
10+
public extension View {
11+
12+
/// View의 Load시점을 감지하는 메서드
13+
/// - Parameter action: closure
14+
func onLoad(perform action: (() -> Void)? = nil) -> some View {
15+
modifier(ViewDidLoadModifier(perform: action))
16+
}
17+
}
18+
19+
/// View의 Load시점을 감지하는 ViewModifier
20+
private struct ViewDidLoadModifier: ViewModifier {
21+
@State private var didLoad = false
22+
private let action: (() -> Void)?
23+
24+
init(perform action: (() -> Void)? = nil) {
25+
self.action = action
26+
}
27+
28+
func body(content: Content) -> some View {
29+
content.onAppear {
30+
if didLoad == false {
31+
didLoad = true
32+
action?()
33+
}
34+
}
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// NSObject+identifier.swift
3+
//
4+
//
5+
// Created by 쩡화니 on 5/22/24.
6+
//
7+
8+
import UIKit
9+
10+
extension NSObject: ReusableID {}
11+
12+
protocol ReusableID {}
13+
14+
extension ReusableID {
15+
/// Reuse identifier
16+
static var identifier: String {
17+
return String(describing: self)
18+
}
19+
}

0 commit comments

Comments
 (0)