Skip to content

Commit

Permalink
Small improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
imodeveloper committed Aug 8, 2024
1 parent 322a66a commit a02a8d5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 38 deletions.
32 changes: 16 additions & 16 deletions DSKit/Sources/DSKit/Helpers/DSTextField+Factory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public extension DSTextField {
textContentType: .emailAddress,
autocapitalizationType: .none,
validationPattern: "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,64}",
keftSystemName: "envelope.fill",
leftSystemName: "envelope.fill",
validateMinimumLength: 5,
validateMaximumLength: 250,
validateEmptyTextField: false
Expand Down Expand Up @@ -46,7 +46,7 @@ public extension DSTextField {
textContentType: .telephoneNumber,
autocapitalizationType: .none,
validationPattern: customValidationPattern ?? "^\\s*(?:\\+?(\\d{1,3}))?([-. (]*(\\d{3})[-. )]*)?((\\d{3})[-. ]*(\\d{2,4})(?:[-.x ]*(\\d+))?)\\s*$",
keftSystemName: "phone.fill",
leftSystemName: "phone.fill",
validateMinimumLength: 5,
validateMaximumLength: 35,
validateEmptyTextField: false
Expand Down Expand Up @@ -74,7 +74,7 @@ public extension DSTextField {
textContentType: .oneTimeCode,
autocapitalizationType: .none,
validationPattern: customValidationPattern ?? "^[a-zA-Z0-9]*$",
keftSystemName: "lock",
leftSystemName: "lock",
validateMinimumLength: 4,
validateMaximumLength: 10,
validateEmptyTextField: false
Expand Down Expand Up @@ -102,7 +102,7 @@ public extension DSTextField {
textContentType: .password,
autocapitalizationType: .none,
validationPattern: customValidationPattern ?? "",
keftSystemName: "lock.fill",
leftSystemName: "lock.fill",
validateMinimumLength: 8,
validateMaximumLength: 14,
validateEmptyTextField: false
Expand Down Expand Up @@ -130,7 +130,7 @@ public extension DSTextField {
textContentType: .newPassword,
autocapitalizationType: .none,
validationPattern: customValidationPattern ?? "",
keftSystemName: "lock.fill",
leftSystemName: "lock.fill",
validateMinimumLength: 8,
validateMaximumLength: 14,
validateEmptyTextField: false
Expand Down Expand Up @@ -159,7 +159,7 @@ public extension DSTextField {
textContentType: .name,
autocapitalizationType: .words,
validationPattern: customValidationPattern ?? "^[\\u0600-\\u06FFa-zA-Z\\s\\'\\-]*$",
keftSystemName: "person.crop.circle",
leftSystemName: "person.crop.circle",
validateMinimumLength: 3,
validateMaximumLength: 35,
validateEmptyTextField: false
Expand Down Expand Up @@ -188,7 +188,7 @@ public extension DSTextField {
textContentType: .givenName,
autocapitalizationType: .words,
validationPattern: customValidationPattern ?? "^[\\u0600-\\u06FFa-zA-Z\\s\\'\\-]*$",
keftSystemName: "person.crop.circle",
leftSystemName: "person.crop.circle",
validateMinimumLength: 3,
validateMaximumLength: 35,
validateEmptyTextField: false
Expand Down Expand Up @@ -217,7 +217,7 @@ public extension DSTextField {
textContentType: .familyName,
autocapitalizationType: .words,
validationPattern: customValidationPattern ?? "^[\\u0600-\\u06FFa-zA-Z\\s\\'\\-]*$",
keftSystemName: "person.crop.circle",
leftSystemName: "person.crop.circle",
validateMinimumLength: 3,
validateMaximumLength: 35,
validateEmptyTextField: false
Expand Down Expand Up @@ -245,7 +245,7 @@ public extension DSTextField {
textContentType: nil, // Adjust if there's a more appropriate content type for numbers
autocapitalizationType: .none,
validationPattern: customValidationPattern ?? "^[0-9]*$",
keftSystemName: "number.circle",
leftSystemName: "number.circle",
validateMinimumLength: 3,
validateMaximumLength: 35,
validateEmptyTextField: false
Expand Down Expand Up @@ -273,7 +273,7 @@ public extension DSTextField {
textContentType: .fullStreetAddress,
autocapitalizationType: .words,
validationPattern: customValidationPattern ?? "^[\\u0600-\\u06FFa-zA-Z0-9\\s\\'\\-]*$",
keftSystemName: "house",
leftSystemName: "house",
validateMinimumLength: 3,
validateMaximumLength: 250,
validateEmptyTextField: false
Expand All @@ -298,7 +298,7 @@ public extension DSTextField {
textContentType: .none, // Adjust as needed
autocapitalizationType: .sentences,
validationPattern: "", // No specific validation pattern
keftSystemName: "magnifyingglass",
leftSystemName: "magnifyingglass",
validateMinimumLength: 0,
validateMaximumLength: 200,
validateEmptyTextField: true // Adjust based on whether empty search is allowed
Expand Down Expand Up @@ -326,7 +326,7 @@ public extension DSTextField {
textContentType: .streetAddressLine1,
autocapitalizationType: .words,
validationPattern: customValidationPattern ?? "^[\\u0600-\\u06FFa-zA-Z0-9\\s\\'\\-]*$",
keftSystemName: "house",
leftSystemName: "house",
validateMinimumLength: 3,
validateMaximumLength: 250,
validateEmptyTextField: false
Expand Down Expand Up @@ -354,7 +354,7 @@ public extension DSTextField {
textContentType: .streetAddressLine2,
autocapitalizationType: .words,
validationPattern: customValidationPattern ?? "^[\\u0600-\\u06FFa-zA-Z0-9\\s\\'\\-]*$",
keftSystemName: "house",
leftSystemName: "house",
validateMinimumLength: 3,
validateMaximumLength: 250,
validateEmptyTextField: false
Expand Down Expand Up @@ -382,7 +382,7 @@ public extension DSTextField {
textContentType: .addressState,
autocapitalizationType: .words,
validationPattern: customValidationPattern ?? "^[\\u0600-\\u06FFa-zA-Z0-9\\s\\'\\-]*$",
keftSystemName: "network",
leftSystemName: "network",
validateMinimumLength: 3,
validateMaximumLength: 250,
validateEmptyTextField: false
Expand Down Expand Up @@ -410,7 +410,7 @@ public extension DSTextField {
textContentType: .addressCity,
autocapitalizationType: .words,
validationPattern: customValidationPattern ?? "^[\\u0600-\\u06FFa-zA-Z0-9\\s\\'\\-]*$",
keftSystemName: "building.2",
leftSystemName: "building.2",
validateMinimumLength: 3,
validateMaximumLength: 250,
validateEmptyTextField: false
Expand Down Expand Up @@ -438,7 +438,7 @@ public extension DSTextField {
textContentType: .addressCityAndState,
autocapitalizationType: .words,
validationPattern: customValidationPattern ?? "^[\\u0600-\\u06FFa-zA-Z0-9\\s\\'\\-]*$",
keftSystemName: "house",
leftSystemName: "house",
validateMinimumLength: 3,
validateMaximumLength: 250,
validateEmptyTextField: false
Expand Down
8 changes: 4 additions & 4 deletions DSKit/Sources/DSKit/Views/DSButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public struct DSButton: View {

public init(
title: String,
keftSystemName: String? = nil,
leftSystemName: String? = nil,
rightSystemName: String? = nil,
pushContentToSides: Bool = false,
style: Style = .default,
Expand All @@ -140,8 +140,8 @@ public struct DSButton: View {
action: @escaping () -> Void
) {
var leftImage: DSImage?
if let keftSystemName {
leftImage = DSImage(content: .system(name: keftSystemName), size: .smallIcon)
if let leftSystemName {
leftImage = DSImage(content: .system(name: leftSystemName), size: .smallIcon)
}

var rightImage: DSImage?
Expand Down Expand Up @@ -318,7 +318,7 @@ struct Testable_DSButton: View {
)
DSButton(
title: "Bordered Light",
keftSystemName: "message.fill",
leftSystemName: "message.fill",
style: .borderedLight,
action: { }
)
Expand Down
4 changes: 2 additions & 2 deletions DSKit/Sources/DSKit/Views/DSTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public struct DSTextField: View {
let textContentType: UITextContentType?
let autocapitalizationType: UITextAutocapitalizationType
let validationPattern: String
let keftSystemName: String?
let leftSystemName: String?
let validateMinimumLength: Int
let validateMaximumLength: Int
let validateEmptyTextField: Bool

public var body: some View {
DSHStack {
if let symbolName = keftSystemName {
if let symbolName = leftSystemName {
DSImageView(
systemName: symbolName,
size: 15,
Expand Down
29 changes: 13 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ DSKit is a simple Design System Kit for **iOS 15+ SwiftUI**, designed to help de

<img src="Content/Images/Preview.png">

To help you get started, DSKit includes demonstration screen code showcasing a wide range of possibilities. With over 60 ready-to-use screens, you can see the full potential of DSKit in action. This extensive collection of ready-made code can be directly utilized in your next project, making it easier to integrate DSKit's features and functionalities seamlessly.

#### E-Commerce

<img src="Content/Images/e-commerce.png">

#### Barbershop

<img src="Content/Images/barbershop.png">

#### Food Delivery

<img src="Content/Images/food.png">

## Get Started

Expand Down Expand Up @@ -105,22 +118,6 @@ To dive deeper into specific features and functionalities, continue to the secti
- [Views / Components](Content/Views.md)
- [Appearance](Content/Appearance-in-DSKit.md)

### Demo Screens

To help you get started, DSKit includes demonstration screen code showcasing a wide range of possibilities. With over 60 ready-to-use screens, you can see the full potential of DSKit in action. This extensive collection of ready-made code can be directly utilized in your next project, making it easier to integrate DSKit's features and functionalities seamlessly.

#### E-Commerce

<img src="Content/Images/e-commerce.png">

#### Barbershop

<img src="Content/Images/barbershop.png">

#### Food Delivery

<img src="Content/Images/food.png">

## Contributions and support

DSKit is developed completely in the open, and your contributions are more than welcome.
Expand Down

0 comments on commit a02a8d5

Please sign in to comment.