Skip to content

Commit

Permalink
Merge pull request #2 from badoo/add_hl_prefix_for_hyperlabel
Browse files Browse the repository at this point in the history
Adding a HL prefix for HyperLabel class
  • Loading branch information
wiruzx authored Nov 6, 2019
2 parents af3cf21 + 5e3cb29 commit 3d679d6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions HyperLabel.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/* Begin PBXBuildFile section */
2636291B226697BD0060FDA1 /* HyperLabelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2636291A226697BD0060FDA1 /* HyperLabelProtocol.swift */; };
267498852260F8570000AA3D /* TextContainerData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2674987F2260F8570000AA3D /* TextContainerData.swift */; };
267498862260F8570000AA3D /* HyperLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 267498802260F8570000AA3D /* HyperLabel.swift */; };
267498862260F8570000AA3D /* HLHyperLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 267498802260F8570000AA3D /* HLHyperLabel.swift */; };
267498872260F8570000AA3D /* HyperLabelPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 267498812260F8570000AA3D /* HyperLabelPresenter.swift */; };
267498882260F8570000AA3D /* HyperLabelTextStyler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 267498822260F8570000AA3D /* HyperLabelTextStyler.swift */; };
267498892260F8570000AA3D /* RangeMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 267498832260F8570000AA3D /* RangeMap.swift */; };
Expand All @@ -33,7 +33,7 @@
/* Begin PBXFileReference section */
2636291A226697BD0060FDA1 /* HyperLabelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HyperLabelProtocol.swift; sourceTree = "<group>"; };
2674987F2260F8570000AA3D /* TextContainerData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextContainerData.swift; sourceTree = "<group>"; };
267498802260F8570000AA3D /* HyperLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HyperLabel.swift; sourceTree = "<group>"; };
267498802260F8570000AA3D /* HLHyperLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HLHyperLabel.swift; sourceTree = "<group>"; };
267498812260F8570000AA3D /* HyperLabelPresenter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HyperLabelPresenter.swift; sourceTree = "<group>"; };
267498822260F8570000AA3D /* HyperLabelTextStyler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HyperLabelTextStyler.swift; sourceTree = "<group>"; };
267498832260F8570000AA3D /* RangeMap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RangeMap.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -89,7 +89,7 @@
children = (
267498842260F8570000AA3D /* TextLayoutInfoProvider.swift */,
26F88A362265595A00549C30 /* LinkAccessibilityElement.swift */,
267498802260F8570000AA3D /* HyperLabel.swift */,
267498802260F8570000AA3D /* HLHyperLabel.swift */,
2636291A226697BD0060FDA1 /* HyperLabelProtocol.swift */,
267498812260F8570000AA3D /* HyperLabelPresenter.swift */,
267498822260F8570000AA3D /* HyperLabelTextStyler.swift */,
Expand Down Expand Up @@ -227,7 +227,7 @@
267498852260F8570000AA3D /* TextContainerData.swift in Sources */,
2636291B226697BD0060FDA1 /* HyperLabelProtocol.swift in Sources */,
2674988A2260F8570000AA3D /* TextLayoutInfoProvider.swift in Sources */,
267498862260F8570000AA3D /* HyperLabel.swift in Sources */,
267498862260F8570000AA3D /* HLHyperLabel.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import UIKit

public final class HyperLabel: UILabel, HyperLabelProtocol {
public final class HLHyperLabel: UILabel, HyperLabelProtocol {

public override init(frame: CGRect) {
super.init(frame: frame)
Expand Down
10 changes: 5 additions & 5 deletions HyperLabelDemo/HyperLabelDemo/LabelExample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ extension Array where Element == LabelExample {
static func makeExamples() -> [LabelExample] {
return [
LabelExample(title: "Exact touchable area") {
HyperLabel.makeDemoLabel(extendLinkTouchArea: false)
HLHyperLabel.makeDemoLabel(extendLinkTouchArea: false)
},
LabelExample(title: "Extended touchable area") {
HyperLabel.makeDemoLabel(extendLinkTouchArea: true)
HLHyperLabel.makeDemoLabel(extendLinkTouchArea: true)
},
]
}
}

// MARK: - HyperLabel example

private extension HyperLabel {
static func makeDemoLabel(extendLinkTouchArea: Bool) -> HyperLabel {
let label = HyperLabel()
private extension HLHyperLabel {
static func makeDemoLabel(extendLinkTouchArea: Bool) -> HLHyperLabel {
let label = HLHyperLabel()
label.numberOfLines = 0
label.extendsLinkTouchArea = extendLinkTouchArea
label.additionalLinkAttributes = [
Expand Down
8 changes: 4 additions & 4 deletions HyperLabelTests/HyperLabelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class HyperLabelTests: XCTestCase {
// Given
// '’' is UTF16?
let exampleText = "You’ll be happy one day."
let sut: HyperLabel = {
let hyperLabel = HyperLabel()
let sut: HLHyperLabel = {
let hyperLabel = HLHyperLabel()
hyperLabel.numberOfLines = 0
hyperLabel.text = exampleText
hyperLabel.additionalLinkAttributes = [.underlineStyle: NSUnderlineStyle.single.rawValue]
Expand All @@ -52,8 +52,8 @@ class HyperLabelTests: XCTestCase {
func test_GivenSimpleText_WhenAddLink_ThenRangesAreCorrect() {
// Given
let exampleText = "Look's good with no special characters."
let sut: HyperLabel = {
let hyperLabel = HyperLabel()
let sut: HLHyperLabel = {
let hyperLabel = HLHyperLabel()
hyperLabel.numberOfLines = 0
hyperLabel.text = exampleText
hyperLabel.additionalLinkAttributes = [.underlineStyle: NSUnderlineStyle.single.rawValue]
Expand Down

0 comments on commit 3d679d6

Please sign in to comment.