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
Abstract hint service #106
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7ec5569
created and used abstract hint service
3cb7783
fixes for example project
8f5901a
small refactoring for height layout policy, removed deprecated policy
df6616e
ability to manage possible visible states for hint
cc22cab
added documentation comments
83de0a1
Merge branch 'dev/version-1' into abstract-hint-service
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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
33 changes: 33 additions & 0 deletions
33
TextFieldsCatalog/Resources/Constants/HintVisibleStates.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,33 @@ | ||
// | ||
// HintMessageState.swift | ||
// TextFieldsCatalog | ||
// | ||
// Created by Александр Чаусов on 05.01.2021. | ||
// Copyright © 2021 Александр Чаусов. All rights reserved. | ||
// | ||
|
||
/// Option set for managing possible visible states for fields hint message. | ||
/// | ||
/// You can provide needed set to hint service init method or | ||
/// change this set for specific field with appropriate method. | ||
/// Hint or error messages will be shown only for specified states. | ||
public struct HintVisibleStates: OptionSet { | ||
|
||
// MARK: - Public Properties | ||
|
||
public let rawValue: Int | ||
|
||
public static let error = HintVisibleStates(rawValue: 1 << 0) | ||
public static let disabled = HintVisibleStates(rawValue: 1 << 1) | ||
public static let normal = HintVisibleStates(rawValue: 1 << 2) | ||
public static let active = HintVisibleStates(rawValue: 1 << 3) | ||
|
||
public static let all: HintVisibleStates = [.error, .disabled, .normal, .active] | ||
|
||
// MARK: - Initialization | ||
|
||
public init(rawValue: Int) { | ||
self.rawValue = rawValue | ||
} | ||
|
||
} |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вообще как то усложнилась логика - мы в elastic policy указываем flexible policy...
И вызов стал тяжелее
.elastic(policy: .init(minHeight: 77, bottomOffset: 5, ignoreEmptyHint: false))
Но это вкусовщина и ничего лучше я предложить не могу :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
понял, погляжу, но скорее всего тоже ничего предложить не смогу :(