Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion TechDocs/uikit_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Содержание

- [ActionableLabel](#actionableLabel) - Лэйбл сбирающийся из строк с разными аттрибутами
- [BlurBuilder](#blurbuilder) - упрощение работы с blur-эффектом
- [ItemsScrollManager](#itemsscrollmanager) - менеджер для поэлементного скролла карусели
- [KeyboardPresentable](#keyboardpresentable) - семейство протоколов для упрощения работы с клавиатурой и сокращения количества одинакового кода
Expand All @@ -17,6 +18,40 @@
- [TouchableControl](#touchablecontrol) – аналог кнопки с кастомизированным анимированием
- [CustomSwitch](#customswitch) – более гибкая реализация Switch ui элемента

### ActionableLabel

Лэйбл который можно собирать из текстов с разными аттрибутами, так же обрабатывает нажатия, например ссылки.

Пример:

Во вью
```Swift
typealias Model = [(text: String, didSelect: (()-> Void)?)]

func configure(with model: Model) {
label.clear()
model.forEach { part in
label.append(
text: part.text,
attributes: part.didSelect == nil ? [] : [.foregroundColor(selectColor)],
action: {
part.didSelect?()
}
)
}
}
```

В презенторе
```Swift

view?.configure(with: [
(text: "Start sentences ", didSelect: nil),
(text: "link text", didSelect: { print("link selected") }),
(text: " end sentences.", didSelect: nil)
])
```

### BlurBuilder

Утилита для упрощения добавления стандартного блюра на какое-либо View, позволяет управлять стилем и цветом блюра.
Expand Down Expand Up @@ -495,4 +530,4 @@ customSwitch.setOn(true, animated: false)
@IBAction func switchValueDidChange(_ sender: CustomSwitch) {
print(sender.isOn)
}
```
```
61 changes: 61 additions & 0 deletions Utils.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
objects = {

/* Begin PBXBuildFile section */
08E6092D2980000500C224CC /* Autolocalizable in Frameworks */ = {isa = PBXBuildFile; productRef = 08E6092C2980000500C224CC /* Autolocalizable */; };
08E609302980038800C224CC /* ActionableLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E6092F2980038800C224CC /* ActionableLabel.swift */; };
08E609322980066700C224CC /* StringAttribute+Array.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E609312980066700C224CC /* StringAttribute+Array.swift */; };
08E6093729800E3A00C224CC /* ViewAccessibilityProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E6093629800E3A00C224CC /* ViewAccessibilityProtocol.swift */; };
08E609392980101E00C224CC /* AccessibilityIdentifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E609382980101E00C224CC /* AccessibilityIdentifiers.swift */; };
08E6093C298013D800C224CC /* ActionableLabelDefaultParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E6093B298013D800C224CC /* ActionableLabelDefaultParameters.swift */; };
18F2361421D2150200169AC9 /* Dictionary+QueryStringBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18F2361321D2150200169AC9 /* Dictionary+QueryStringBuilder.swift */; };
3946574E24EC1A580069BDB0 /* LoadingViewBlock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3946574D24EC1A580069BDB0 /* LoadingViewBlock.swift */; };
3946575024EC1AAC0069BDB0 /* LoadingViewConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3946574F24EC1AAC0069BDB0 /* LoadingViewConfig.swift */; };
Expand Down Expand Up @@ -110,6 +116,11 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
08E6092F2980038800C224CC /* ActionableLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionableLabel.swift; sourceTree = "<group>"; };
08E609312980066700C224CC /* StringAttribute+Array.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "StringAttribute+Array.swift"; sourceTree = "<group>"; };
08E6093629800E3A00C224CC /* ViewAccessibilityProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewAccessibilityProtocol.swift; sourceTree = "<group>"; };
08E609382980101E00C224CC /* AccessibilityIdentifiers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccessibilityIdentifiers.swift; sourceTree = "<group>"; };
08E6093B298013D800C224CC /* ActionableLabelDefaultParameters.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionableLabelDefaultParameters.swift; sourceTree = "<group>"; };
18F2361321D2150200169AC9 /* Dictionary+QueryStringBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Dictionary+QueryStringBuilder.swift"; sourceTree = "<group>"; };
39262D442551713B00591787 /* PinCryptoBoxTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinCryptoBoxTests.swift; sourceTree = "<group>"; };
39262D4C2551714F00591787 /* PinHackCryptoBoxTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PinHackCryptoBoxTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -212,6 +223,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
08E6092D2980000500C224CC /* Autolocalizable in Frameworks */,
90AAE2FE2851F2890088A5A4 /* CryptoSwift in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -227,6 +239,33 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
08E6092E2980035500C224CC /* ActionableLabel */ = {
isa = PBXGroup;
children = (
08E6093A2980138100C224CC /* Protocols */,
08E6093329800DEA00C224CC /* Accessibility */,
08E6092F2980038800C224CC /* ActionableLabel.swift */,
);
path = ActionableLabel;
sourceTree = "<group>";
};
08E6093329800DEA00C224CC /* Accessibility */ = {
isa = PBXGroup;
children = (
08E609382980101E00C224CC /* AccessibilityIdentifiers.swift */,
);
path = Accessibility;
sourceTree = "<group>";
};
08E6093A2980138100C224CC /* Protocols */ = {
isa = PBXGroup;
children = (
08E6093629800E3A00C224CC /* ViewAccessibilityProtocol.swift */,
08E6093B298013D800C224CC /* ActionableLabelDefaultParameters.swift */,
);
path = Protocols;
sourceTree = "<group>";
};
18F2361221D214CC00169AC9 /* Dictionary */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -377,6 +416,7 @@
4F3ED9E1211C27CF0030DD45 /* Utils */ = {
isa = PBXGroup;
children = (
08E6092E2980035500C224CC /* ActionableLabel */,
A4F4B13524ED2490009FA920 /* BeanPageControl */,
80437D24214045B30095A8D0 /* BrightSide */,
5709EC5B236F4C2200EEBD93 /* CommonButton */,
Expand Down Expand Up @@ -429,6 +469,7 @@
children = (
4F3ED9FB211C27FD0030DD45 /* String+Attributes.swift */,
D6040DFB22C5F3E20088BB50 /* StringBuilder.swift */,
08E609312980066700C224CC /* StringAttribute+Array.swift */,
);
path = String;
sourceTree = "<group>";
Expand Down Expand Up @@ -743,6 +784,7 @@
name = Utils;
packageProductDependencies = (
90AAE2FD2851F2890088A5A4 /* CryptoSwift */,
08E6092C2980000500C224CC /* Autolocalizable */,
);
productName = Utils;
productReference = 4F3ED9DF211C27CF0030DD45 /* Utils.framework */;
Expand Down Expand Up @@ -796,6 +838,7 @@
mainGroup = 4F3ED9D5211C27CF0030DD45;
packageReferences = (
90AAE2FC2851F2890088A5A4 /* XCRemoteSwiftPackageReference "CryptoSwift" */,
08E6092B2980000500C224CC /* XCRemoteSwiftPackageReference "Autolocalizable" */,
);
productRefGroup = 4F3ED9E0211C27CF0030DD45 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -862,6 +905,7 @@
C11CEB4824D44E2C00C1CD0F /* MailSenderRouterHelper.swift in Sources */,
907F0FEC21DCD7E1001CCB07 /* RouteMeasurer.swift in Sources */,
89293B2621F59F6A0016C6BE /* LocalStorage.swift in Sources */,
08E6093729800E3A00C224CC /* ViewAccessibilityProtocol.swift in Sources */,
18F2361421D2150200169AC9 /* Dictionary+QueryStringBuilder.swift in Sources */,
E9B063102147AECC0080C391 /* UIDevice+feedbackType.swift in Sources */,
9087BC5421EF3BF200FCE1E1 /* FullKeyboardPresentable.swift in Sources */,
Expand All @@ -877,8 +921,10 @@
A4D5D5FD24E57A6A004ABFBC /* CustomSwitch.swift in Sources */,
3946575524EC1E600069BDB0 /* BaseLoadingView.swift in Sources */,
907F0FE621DCD3A0001CCB07 /* SettingsRouter.swift in Sources */,
08E609392980101E00C224CC /* AccessibilityIdentifiers.swift in Sources */,
3946575924EC21350069BDB0 /* LoadingSubview.swift in Sources */,
9E7724CA2562C3CC00E86D81 /* MailSenderPayload.swift in Sources */,
08E6093C298013D800C224CC /* ActionableLabelDefaultParameters.swift in Sources */,
E9B0630C214692C30080C391 /* UIDevice+hasTapticEngine.swift in Sources */,
3971F72524F1843900597F9D /* SecureStore.swift in Sources */,
3971F72324F1843900597F9D /* InMemorySecureStore.swift in Sources */,
Expand All @@ -890,6 +936,7 @@
80437D26214045EF0095A8D0 /* BrightSide.swift in Sources */,
A4F4B13724ED24A4009FA920 /* BeanPageControl.swift in Sources */,
898845202360482D004940DC /* UIView+XibSetup.swift in Sources */,
08E609322980066700C224CC /* StringAttribute+Array.swift in Sources */,
90AC8567238592A700DF7F3B /* GeolocationAccuracy.swift in Sources */,
5709EC5D236F4C6500EEBD93 /* CommonButton.swift in Sources */,
579EAFCE27022F47004E092B /* GeolocationServiceInterface.swift in Sources */,
Expand All @@ -907,6 +954,7 @@
90718AF121EA370000C81002 /* KeyboardNotificationsObserver.swift in Sources */,
397CDAD124EF9F6C00FB0EAA /* PinCryptoBox.swift in Sources */,
39DCF1A224EE7C66007CCFBC /* UIImage+badgedImage.swift in Sources */,
08E609302980038800C224CC /* ActionableLabel.swift in Sources */,
904DE28B272DCF70004FDC64 /* MapRoutingLocationServiceInterface.swift in Sources */,
90AC8569238592AF00DF7F3B /* GeolocationAuthResult.swift in Sources */,
5709EC6A236F562400EEBD93 /* UIImageExtensions.swift in Sources */,
Expand Down Expand Up @@ -1215,6 +1263,14 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
08E6092B2980000500C224CC /* XCRemoteSwiftPackageReference "Autolocalizable" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/surfstudio/Autolocalizable.git";
requirement = {
kind = exactVersion;
version = 1.1.0;
};
};
90AAE2FC2851F2890088A5A4 /* XCRemoteSwiftPackageReference "CryptoSwift" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/krzyzanowskim/CryptoSwift";
Expand All @@ -1226,6 +1282,11 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
08E6092C2980000500C224CC /* Autolocalizable */ = {
isa = XCSwiftPackageProductDependency;
package = 08E6092B2980000500C224CC /* XCRemoteSwiftPackageReference "Autolocalizable" */;
productName = Autolocalizable;
};
90AAE2FD2851F2890088A5A4 /* CryptoSwift */ = {
isa = XCSwiftPackageProductDependency;
package = 90AAE2FC2851F2890088A5A4 /* XCRemoteSwiftPackageReference "CryptoSwift" */;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Utils/ActionableLabel/Accessibility/AccessibilityIdentifiers.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// AccessibilityIdentifiers.swift
// Unicredit
//
// Created by Егор Егоров on 12/02/2020.
// Copyright © 2020 Surf. All rights reserved.
//

public enum AccessibilityIdentifiers {

public enum Label {
public static let actionable = "actionable_label"
}

}
Loading