generated from GSM-MSG/MSG-Repository-Generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '334-authentication-form-ui-building' of https://github.…
…com/GSM-MSG/SMS-iOS into 334-authentication-form-ui-building
- Loading branch information
Showing
7 changed files
with
97 additions
and
14 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
Projects/Core/DesignSystem/Resources/Icon/Icons.xcassets/File.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "file.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Projects/Core/DesignSystem/Resources/Icon/Icons.xcassets/File.imageset/file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
Projects/Core/DesignSystem/Resources/Icon/Icons.xcassets/Xmark.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "xmark.svg", | ||
"filename" : "Xmark.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
|
64 changes: 64 additions & 0 deletions
64
Projects/Core/DesignSystem/Sources/File/SMSFileField.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import SwiftUI | ||
import ViewUtil | ||
import UniformTypeIdentifiers | ||
|
||
public struct SMSFileField: View { | ||
private let placeholder: String? | ||
private let fileText: String? | ||
@State private var isShow: Bool = false | ||
private let isError: Bool | ||
private let errorText: String | ||
private let allowedContentTypes: [UTType] | ||
private let action: (Result<URL, Error>) -> Void | ||
|
||
public init( | ||
_ placeholder: String? = nil, | ||
fileText: String?, | ||
isError: Bool = false, | ||
errorText: String = "", | ||
allowedContentTypes: [UTType] = [.content], | ||
action: @escaping (Result<URL, Error>) -> Void | ||
) { | ||
self.placeholder = placeholder | ||
self.fileText = fileText | ||
self.isError = isError | ||
self.errorText = errorText | ||
self.allowedContentTypes = allowedContentTypes | ||
self.action = action | ||
} | ||
|
||
public var body: some View { | ||
SMSTextField( | ||
placeholder ?? "", | ||
text: Binding( | ||
get: { fileText ?? "" }, | ||
set: { _ in } | ||
), | ||
errorText: errorText, | ||
isError: isError, | ||
isOnClear: false | ||
) | ||
.disabled(true) | ||
.overlay(alignment: .trailing) { | ||
SMSIcon(.file) | ||
.padding(.trailing, 12) | ||
} | ||
.simultaneousGesture( | ||
TapGesture() | ||
.onEnded { | ||
self.isShow = true | ||
} | ||
) | ||
.fileImporter( | ||
isPresented: Binding( | ||
get: { isShow }, | ||
set: { active in | ||
isShow = active | ||
} | ||
), | ||
allowedContentTypes: allowedContentTypes | ||
) { result in | ||
action(result) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters