Skip to content

Commit c7d0327

Browse files
committed
updated demo so that it can run on iOS9
1 parent 734d0fe commit c7d0327

4 files changed

Lines changed: 28 additions & 12 deletions

File tree

AttributedTextView.xcodeproj/project.pbxproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@
372372
};
373373
7F652A741DEE09E900A1E61F = {
374374
CreatedOnToolsVersion = 8.1;
375-
DevelopmentTeam = NFYKDD8CR4;
375+
DevelopmentTeam = 6Z7QY98HTS;
376376
ProvisioningStyle = Automatic;
377377
};
378378
};
@@ -834,9 +834,9 @@
834834
isa = XCBuildConfiguration;
835835
buildSettings = {
836836
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
837-
DEVELOPMENT_TEAM = NFYKDD8CR4;
837+
DEVELOPMENT_TEAM = 6Z7QY98HTS;
838838
INFOPLIST_FILE = Demo/Info.plist;
839-
IPHONEOS_DEPLOYMENT_TARGET = 10.1;
839+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
840840
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks $(CONFIGURATION_BUILD_DIR)";
841841
PRODUCT_BUNDLE_IDENTIFIER = nl.evict.Demo;
842842
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -849,9 +849,9 @@
849849
isa = XCBuildConfiguration;
850850
buildSettings = {
851851
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
852-
DEVELOPMENT_TEAM = NFYKDD8CR4;
852+
DEVELOPMENT_TEAM = 6Z7QY98HTS;
853853
INFOPLIST_FILE = Demo/Info.plist;
854-
IPHONEOS_DEPLOYMENT_TARGET = 10.1;
854+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
855855
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks $(CONFIGURATION_BUILD_DIR)";
856856
PRODUCT_BUNDLE_IDENTIFIER = nl.evict.Demo;
857857
PRODUCT_NAME = "$(TARGET_NAME)";

Demo/AttributedTextViewSubclassDemo.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ import UIKit
2525
override func configureAttributedTextView() {
2626
if let text = self.text, let linkText = self.linkText, let linkUrl = self.linkUrl {
2727
self.attributer = text.green.match(linkText).makeInteract { _ in
28-
UIApplication.shared.open(URL(string: linkUrl)!, options: [:], completionHandler: { completed in })
28+
if #available(iOS 10, *) {
29+
UIApplication.shared.open(URL(string: linkUrl)!, options: [:], completionHandler: { completed in })
30+
} else {
31+
_ = UIApplication.shared.openURL(URL(string: linkUrl)!)
2932
}
33+
}
3034
} else {
3135
self.attributer = (self.text ?? "").green
3236
}

Demo/Base.lproj/Main.storyboard

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
33
<device id="retina4_7" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
77
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
99
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1010
</dependencies>
1111
<scenes>
@@ -47,7 +47,7 @@
4747
</userDefinedRuntimeAttributes>
4848
</textView>
4949
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="There should be a checklist here" lineBreakMode="wordWrap" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FMu-K3-dvr" customClass="AttributedLabelSubclassDemo" customModule="Demo" customModuleProvider="target">
50-
<rect key="frame" x="16" y="396" width="343" height="248.5"/>
50+
<rect key="frame" x="16" y="396" width="343" height="20.5"/>
5151
<fontDescription key="fontDescription" type="system" pointSize="17"/>
5252
<nil key="textColor"/>
5353
<nil key="highlightedColor"/>

Demo/ViewController.swift

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ class ViewController: UIViewController {
5555
.append("This is the first test. ").green
5656
.append("Tap on ").black
5757
.append("evict.nl").makeInteract { _ in
58-
UIApplication.shared.open(URL(string: "http://evict.nl")!, options: [:] as [String: Any], completionHandler: { completed in })
58+
if #available(iOS 10, *) {
59+
UIApplication.shared.open(URL(string: "http://evict.nl")!, options: [:], completionHandler: { (completed) in })
60+
} else {
61+
_ = UIApplication.shared.openURL(URL(string: "http://evict.nl")!)
62+
}
5963
}.underline
6064
.append(" for testing links. Or tap on the 'next sample' link below ").black
6165
.underline(.styleDouble, .patternDashDotDot)
@@ -94,11 +98,19 @@ class ViewController: UIViewController {
9498
+ "@test: What #hashtags do we have in @evermeer #AtributedTextView library"
9599
.matchHashtags.underline
96100
.makeInteract { link in
97-
UIApplication.shared.open(URL(string: "https://twitter.com/hashtag/\(link.replacingOccurrences(of: "%23", with: ""))")!, options: [:], completionHandler: { completed in })
101+
if #available(iOS 10, *) {
102+
UIApplication.shared.open(URL(string: "https://twitter.com/hashtag/\(link.replacingOccurrences(of: "%23", with: ""))")!, options: [:], completionHandler: { completed in })
103+
} else {
104+
_ = UIApplication.shared.openURL(URL(string: "https://twitter.com/hashtag/\(link.replacingOccurrences(of: "%23", with: ""))")!)
105+
}
98106
}
99107
.matchMentions
100108
.makeInteract { link in
101-
UIApplication.shared.open(URL(string: "https://twitter.com/\(link.replacingOccurrences(of: "%40", with: ""))")!, options: [:], completionHandler: { completed in })
109+
if #available(iOS 10, *) {
110+
UIApplication.shared.open(URL(string: "https://twitter.com/\(link.replacingOccurrences(of: "%40", with: ""))")!, options: [:], completionHandler: { completed in })
111+
} else {
112+
_ = UIApplication.shared.openURL(URL(string: "https://twitter.com/\(link.replacingOccurrences(of: "%40", with: ""))")!)
113+
}
102114
}
103115
}
104116
}

0 commit comments

Comments
 (0)