-
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 pull request #10 from brunomunizaf/dev
Use NSAttributedString on titles, subtitles and placeholders
- Loading branch information
Showing
22 changed files
with
553 additions
and
470 deletions.
There are no files selected for viewing
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
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,175 @@ | ||
import Forms | ||
import UIKit | ||
|
||
// MARK: - FormInputItem | ||
|
||
extension FormInputItem.Configuration { | ||
static func with( | ||
title: String, | ||
placeholder: String | ||
) -> FormInputItem.Configuration { | ||
FormInputItem.Configuration( | ||
title: [ | ||
NSAttributedString( | ||
string: title, | ||
attributes: [ | ||
.font: UIFont(name: "AvenirNext-Medium", size: 16)!, | ||
.foregroundColor: UIColor.label | ||
]) | ||
], | ||
initialText: nil, | ||
placeholder: [ | ||
NSAttributedString( | ||
string: placeholder, | ||
attributes: [ | ||
.foregroundColor: UIColor.tertiaryLabel, | ||
.font: UIFont(name: "AvenirNext-Regular", size: 16)! | ||
]) | ||
], | ||
isSecure: false, | ||
autocorrectionType: .no, | ||
autocapitalizationType: .none, | ||
font: UIFont(name: "AvenirNext-Regular", size: 16)!, | ||
textColor: UIColor.label, | ||
cornerRadius: 8, | ||
borderWidth: 1.0, | ||
borderColor: UIColor.systemGray, | ||
spacingAfter: 15, | ||
didChange: nil | ||
) | ||
} | ||
} | ||
|
||
|
||
// MARK: - FormSwitchItem | ||
|
||
extension FormSwitchItem.Configuration { | ||
static func with( | ||
title: String, | ||
subtitle: String | ||
) -> FormSwitchItem.Configuration { | ||
FormSwitchItem.Configuration( | ||
title: [ | ||
NSAttributedString( | ||
string: title, | ||
attributes: [ | ||
.foregroundColor: UIColor.label, | ||
.font: UIFont(name: "AvenirNext-Medium", size: 17)! | ||
]) | ||
], | ||
subtitle: [ | ||
NSAttributedString( | ||
string: subtitle, | ||
attributes: [ | ||
.foregroundColor: UIColor.secondaryLabel, | ||
.font: UIFont(name: "AvenirNext-Regular", size: 15)! | ||
]) | ||
], | ||
onColor: .systemBlue, | ||
isOn: false, | ||
spacingAfter: 25 | ||
) | ||
} | ||
} | ||
|
||
// MARK: FormCheckboxItem | ||
|
||
extension FormCheckboxItem.Configuration { | ||
static func with( | ||
title: String, | ||
subtitle: String, | ||
highlightedSubtitle: String | ||
) -> FormCheckboxItem.Configuration { | ||
FormCheckboxItem.Configuration( | ||
title: [ | ||
NSAttributedString( | ||
string: title, | ||
attributes: [ | ||
.foregroundColor: UIColor.label, | ||
.font: UIFont(name: "AvenirNext-Medium", size: 18)! | ||
]) | ||
], | ||
subtitle: [ | ||
NSAttributedString( | ||
string: subtitle, | ||
attributes: [ | ||
.foregroundColor: UIColor.secondaryLabel, | ||
.font: UIFont(name: "AvenirNext-Regular", size: 14)! | ||
]), | ||
NSAttributedString( | ||
string: highlightedSubtitle, | ||
attributes: [ | ||
.foregroundColor: UIColor.secondaryLabel, | ||
.underlineStyle: NSUnderlineStyle.single.rawValue, | ||
.font: UIFont(name: "AvenirNext-Regular", size: 14)! | ||
]) | ||
], | ||
checkedColor: UIColor.systemGreen, | ||
uncheckedColor: UIColor.white, | ||
borderWidth: 1.0, | ||
borderColor: UIColor.lightGray, | ||
cornerRadius: 5.0, | ||
isChecked: false, | ||
spacingAfter: 20.0, | ||
shouldBeSelected: false | ||
) | ||
} | ||
} | ||
|
||
// MARK: FormTextItem | ||
|
||
extension FormTextItem.Configuration { | ||
static func h1(_ title: String) -> FormTextItem.Configuration { | ||
FormTextItem.Configuration( | ||
text: [ | ||
NSAttributedString( | ||
string: title, | ||
attributes: [ | ||
.font: UIFont(name: "AvenirNext-DemiBold", size: 24)!, | ||
.foregroundColor: UIColor.label, | ||
.kern: 0.5 | ||
]) | ||
], | ||
spacingAfter: 20 | ||
) | ||
} | ||
|
||
static func h2(_ title: String) -> FormTextItem.Configuration { | ||
FormTextItem.Configuration( | ||
text: [ | ||
NSAttributedString( | ||
string: title, | ||
attributes: [ | ||
.font: UIFont(name: "AvenirNext-Regular", size: 16)!, | ||
.foregroundColor: UIColor.secondaryLabel, | ||
.kern: 0.2 | ||
]) | ||
], | ||
spacingAfter: 20 | ||
) | ||
} | ||
} | ||
|
||
// MARK: FormButtonItem | ||
|
||
extension FormButtonItem.Configuration { | ||
static func withTitle(_ title: String) -> FormButtonItem.Configuration { | ||
FormButtonItem.Configuration( | ||
title: [ | ||
NSAttributedString( | ||
string: title, | ||
attributes: [ | ||
.font: UIFont(name: "AvenirNext-Bold", size: 20)!, | ||
.foregroundColor: UIColor.white | ||
]) | ||
], | ||
enabledColor: UIColor.systemBlue, | ||
disabledColor: UIColor.systemGray, | ||
borderWidth: 1.0, | ||
borderColor: UIColor.clear, | ||
cornerRadius: 10.0, | ||
spacingAfter: 0, | ||
shouldBeEnabled: false | ||
) | ||
} | ||
} |
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,40 @@ | ||
enum Strings { | ||
enum Personal { | ||
static let title = "Your personal details" | ||
static let subtitle = "Insert your personal information to keep your profile up to date." | ||
static let addressTitle = "Street Address" | ||
static let addressPlaceholder = "e.g. 5912 5th Avenue, New York, NY" | ||
static let nameTitle = "Full Name" | ||
static let namePlaceholder = "Required" | ||
static let phoneTitle = "Phone Number" | ||
static let phonePlaceholder = "Only numbers allowed" | ||
static let calendarTitle = "Date of Birth" | ||
static let button = "Continue to Permissions" | ||
} | ||
|
||
enum Permissions { | ||
static let title = "Manage Permissions" | ||
static let subtitle = "Customize which features the app can access to enhance your user experience." | ||
static let locationTitle = "Location Access" | ||
static let locationSubtitle = "Allow the app to access your location to enhance service delivery and improve user experience." | ||
static let notificationsTitle = "Notifications" | ||
static let notificationsSubtitleA = "Enable notifications to stay updated with the latest news, updates, and offers.\n" | ||
static let notificationsSubtitleB = "Enabling this permission is required." | ||
static let cameraTitle = "Camera Access" | ||
static let cameraSubtitle = "Grant permission to access your camera to take photos and videos within the app." | ||
static let button = "Continue to T&C" | ||
} | ||
|
||
enum Terms { | ||
static let title = "Review Our Terms & Conditions" | ||
static let subtitle = "Please read carefully to understand your rights and obligations while using our services." | ||
static let checkboxTitle = "Acceptance of Terms & Conditions" | ||
static let checkboxSubtitle = "By checking this box, " | ||
static let checkboxSubtitleHighlighted = "you acknowledge that you have read, understood, and agree to abide by the terms and conditions outlined above." | ||
static let button = "Continue to Registration" | ||
} | ||
|
||
enum Finished { | ||
static let title = "Horray! You finished the onboarding. 🎉" | ||
} | ||
} |
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
Oops, something went wrong.