Skip to content

Commit 1994a24

Browse files
committed
Update code for iOS 11
1 parent b155e7d commit 1994a24

11 files changed

Lines changed: 55 additions & 85 deletions

File tree

Aztec.xcodeproj/project.pbxproj

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,7 +1812,7 @@
18121812
GCC_WARN_UNUSED_FUNCTION = YES;
18131813
GCC_WARN_UNUSED_VARIABLE = YES;
18141814
HEADER_SEARCH_PATHS = /usr/include/libxml2;
1815-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
1815+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
18161816
MTL_ENABLE_DEBUG_INFO = YES;
18171817
ONLY_ACTIVE_ARCH = YES;
18181818
OTHER_LDFLAGS = "-lxml2";
@@ -1873,7 +1873,7 @@
18731873
GCC_WARN_UNUSED_FUNCTION = YES;
18741874
GCC_WARN_UNUSED_VARIABLE = YES;
18751875
HEADER_SEARCH_PATHS = /usr/include/libxml2;
1876-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
1876+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
18771877
MTL_ENABLE_DEBUG_INFO = NO;
18781878
OTHER_LDFLAGS = "-lxml2";
18791879
SDKROOT = iphoneos;
@@ -1905,6 +1905,7 @@
19051905
);
19061906
INFOPLIST_FILE = Aztec/Info.plist;
19071907
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
1908+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
19081909
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
19091910
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
19101911
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1934,6 +1935,7 @@
19341935
);
19351936
INFOPLIST_FILE = Aztec/Info.plist;
19361937
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
1938+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
19371939
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
19381940
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
19391941
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2075,7 +2077,7 @@
20752077
GCC_WARN_UNUSED_FUNCTION = YES;
20762078
GCC_WARN_UNUSED_VARIABLE = YES;
20772079
HEADER_SEARCH_PATHS = /usr/include/libxml2;
2078-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
2080+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
20792081
MTL_ENABLE_DEBUG_INFO = NO;
20802082
ONLY_ACTIVE_ARCH = YES;
20812083
OTHER_LDFLAGS = "-lxml2";
@@ -2107,6 +2109,7 @@
21072109
);
21082110
INFOPLIST_FILE = Aztec/Info.plist;
21092111
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
2112+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
21102113
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
21112114
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
21122115
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2187,7 +2190,7 @@
21872190
GCC_WARN_UNUSED_FUNCTION = YES;
21882191
GCC_WARN_UNUSED_VARIABLE = YES;
21892192
HEADER_SEARCH_PATHS = /usr/include/libxml2;
2190-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
2193+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
21912194
MTL_ENABLE_DEBUG_INFO = YES;
21922195
ONLY_ACTIVE_ARCH = YES;
21932196
OTHER_LDFLAGS = "-lxml2";
@@ -2220,6 +2223,7 @@
22202223
);
22212224
INFOPLIST_FILE = Aztec/Info.plist;
22222225
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
2226+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
22232227
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
22242228
PRODUCT_BUNDLE_IDENTIFIER = org.wordpress.Aztec;
22252229
PRODUCT_NAME = "$(TARGET_NAME)";

Aztec/Classes/EditorView/EditorView.swift

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,10 @@ public class EditorView: UIView {
107107

108108
self.htmlTextView = htmlTextView
109109
self.richTextView = richTextView
110-
111-
if #available(iOS 11, *) {
112-
htmlTextView.smartInsertDeleteType = .no
113-
htmlTextView.smartDashesType = .no
114-
htmlTextView.smartQuotesType = .no
115-
}
110+
111+
htmlTextView.smartInsertDeleteType = .no
112+
htmlTextView.smartDashesType = .no
113+
htmlTextView.smartQuotesType = .no
116114

117115
super.init(coder: aDecoder)
118116

@@ -129,12 +127,10 @@ public class EditorView: UIView {
129127

130128
self.htmlTextView = UITextView(frame: .zero, textContainer: container)
131129
self.richTextView = TextView(defaultFont: defaultFont, defaultParagraphStyle: defaultParagraphStyle, defaultMissingImage: defaultMissingImage)
132-
133-
if #available(iOS 11, *) {
134-
htmlTextView.smartInsertDeleteType = .no
135-
htmlTextView.smartDashesType = .no
136-
htmlTextView.smartQuotesType = .no
137-
}
130+
131+
htmlTextView.smartInsertDeleteType = .no
132+
htmlTextView.smartDashesType = .no
133+
htmlTextView.smartQuotesType = .no
138134

139135
super.init(frame: .zero)
140136

Aztec/Classes/GUI/FormatBar/FormatBar.swift

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,7 @@ open class FormatBar: UIView {
326326
open override func didMoveToWindow() {
327327
super.didMoveToWindow()
328328

329-
if #available(iOS 11.0, *) {
330-
updateForSafeAreaInsets()
331-
}
329+
updateForSafeAreaInsets()
332330
}
333331

334332
open override func layoutSubviews() {
@@ -683,13 +681,8 @@ private extension FormatBar {
683681
/// Sets up the Constraints
684682
///
685683
func configureConstraints() {
686-
var leadingAnchor = self.leadingAnchor
687-
var trailingAnchor = self.trailingAnchor
688-
689-
if #available(iOS 11.0, *) {
690-
leadingAnchor = safeAreaLayoutGuide.leadingAnchor
691-
trailingAnchor = safeAreaLayoutGuide.trailingAnchor
692-
}
684+
var leadingAnchor = safeAreaLayoutGuide.leadingAnchor
685+
var trailingAnchor = safeAreaLayoutGuide.trailingAnchor
693686

694687
///Overflow toggle item
695688

Aztec/Classes/TextKit/FontProvider.swift

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,14 @@ public class FontProvider {
1212
public lazy var monospaceFont: UIFont = {
1313
let baseFont = UIFont(descriptor:UIFontDescriptor(name: "Menlo", size: 14), size:14)
1414
let font: UIFont
15-
if #available(iOS 11.0, *) {
16-
font = UIFontMetrics.default.scaledFont(for: baseFont)
17-
} else {
18-
font = baseFont
19-
}
15+
font = UIFontMetrics.default.scaledFont(for: baseFont)
2016
return font
2117
}()
2218

2319
public lazy var defaultFont: UIFont = {
2420
let baseFont = UIFont.systemFont(ofSize: 14)
2521
let font: UIFont
26-
if #available(iOS 11.0, *) {
27-
font = UIFontMetrics.default.scaledFont(for: baseFont)
28-
} else {
29-
font = baseFont
30-
}
22+
font = UIFontMetrics.default.scaledFont(for: baseFont)
3123
return font
3224
}()
3325
}

Aztec/Classes/TextKit/ParagraphProperty/Header.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@ open class Header: ParagraphProperty {
3333

3434
public var fontSize: Float {
3535
let fontSize = HeaderType.fontSizeMap[self] ?? Constants.defaultFontSize
36-
37-
if #available(iOS 11.0, *) {
38-
return Float(UIFontMetrics.default.scaledValue(for: CGFloat(fontSize)))
39-
} else {
40-
return fontSize
41-
}
36+
return Float(UIFontMetrics.default.scaledValue(for: CGFloat(fontSize)))
4237
}
4338
}
4439

Aztec/Classes/TextKit/TextView.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,8 @@ open class TextView: UITextView {
376376
defaultParagraphStyle: ParagraphStyle = ParagraphStyle.default,
377377
defaultMissingImage: UIImage) {
378378

379-
if #available(iOS 11.0, *) {
380-
self.defaultFont = UIFontMetrics.default.scaledFont(for: defaultFont)
381-
} else {
382-
self.defaultFont = defaultFont
383-
}
379+
self.defaultFont = UIFontMetrics.default.scaledFont(for: defaultFont)
380+
384381
self.defaultParagraphStyle = defaultParagraphStyle
385382
self.defaultMissingImage = defaultMissingImage
386383

@@ -407,9 +404,8 @@ open class TextView: UITextView {
407404

408405
private func commonInit() {
409406
allowsEditingTextAttributes = true
410-
if #available(iOS 10.0, *) {
411-
adjustsFontForContentSizeCategory = true
412-
}
407+
adjustsFontForContentSizeCategory = true
408+
413409
storage.attachmentsDelegate = self
414410
font = defaultFont
415411
linkTextAttributes = [.underlineStyle: NSNumber(value: NSUnderlineStyle.single.rawValue), .foregroundColor: tintColor as Any]

Example/AztecExample.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@
582582
GCC_WARN_UNUSED_FUNCTION = YES;
583583
GCC_WARN_UNUSED_VARIABLE = YES;
584584
HEADER_SEARCH_PATHS = /usr/include/libxml2;
585-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
585+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
586586
MTL_ENABLE_DEBUG_INFO = YES;
587587
ONLY_ACTIVE_ARCH = YES;
588588
SDKROOT = iphoneos;
@@ -635,7 +635,7 @@
635635
GCC_WARN_UNUSED_FUNCTION = YES;
636636
GCC_WARN_UNUSED_VARIABLE = YES;
637637
HEADER_SEARCH_PATHS = /usr/include/libxml2;
638-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
638+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
639639
MTL_ENABLE_DEBUG_INFO = NO;
640640
SDKROOT = iphoneos;
641641
STRIP_INSTALLED_PRODUCT = NO;
@@ -797,7 +797,7 @@
797797
GCC_WARN_UNUSED_FUNCTION = YES;
798798
GCC_WARN_UNUSED_VARIABLE = YES;
799799
HEADER_SEARCH_PATHS = /usr/include/libxml2;
800-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
800+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
801801
MTL_ENABLE_DEBUG_INFO = NO;
802802
ONLY_ACTIVE_ARCH = YES;
803803
SDKROOT = iphoneos;
@@ -880,7 +880,7 @@
880880
GCC_WARN_UNUSED_FUNCTION = YES;
881881
GCC_WARN_UNUSED_VARIABLE = YES;
882882
HEADER_SEARCH_PATHS = /usr/include/libxml2;
883-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
883+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
884884
MTL_ENABLE_DEBUG_INFO = YES;
885885
ONLY_ACTIVE_ARCH = YES;
886886
SDKROOT = iphoneos;

Example/Example/EditorDemoController.swift

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,8 @@ class EditorDemoController: UIViewController {
3030

3131
fileprivate(set) lazy var editorView: Aztec.EditorView = {
3232
let defaultHTMLFont: UIFont
33-
34-
if #available(iOS 11, *) {
35-
defaultHTMLFont = UIFontMetrics.default.scaledFont(for: Constants.defaultContentFont)
36-
} else {
37-
defaultHTMLFont = Constants.defaultContentFont
38-
}
33+
34+
defaultHTMLFont = UIFontMetrics.default.scaledFont(for: Constants.defaultContentFont)
3935

4036
let editorView = Aztec.EditorView(
4137
defaultFont: Constants.defaultContentFont,
@@ -63,10 +59,8 @@ class EditorDemoController: UIViewController {
6359
textView.textAttachmentDelegate = self
6460
textView.accessibilityIdentifier = "richContentView"
6561
textView.clipsToBounds = false
66-
if #available(iOS 11, *) {
67-
textView.smartDashesType = .no
68-
textView.smartQuotesType = .no
69-
}
62+
textView.smartDashesType = .no
63+
textView.smartQuotesType = .no
7064
}
7165

7266
private func setupHTMLTextView(_ textView: UITextView) {
@@ -79,14 +73,10 @@ class EditorDemoController: UIViewController {
7973
textView.autocorrectionType = .no
8074
textView.autocapitalizationType = .none
8175
textView.clipsToBounds = false
82-
if #available(iOS 10, *) {
83-
textView.adjustsFontForContentSizeCategory = true
84-
}
85-
86-
if #available(iOS 11, *) {
87-
textView.smartDashesType = .no
88-
textView.smartQuotesType = .no
89-
}
76+
textView.adjustsFontForContentSizeCategory = true
77+
78+
textView.smartDashesType = .no
79+
textView.smartQuotesType = .no
9080
}
9181

9282
fileprivate(set) lazy var titleTextView: UITextView = {
@@ -249,9 +239,8 @@ class EditorDemoController: UIViewController {
249239
func updateScrollInsets() {
250240
var scrollInsets = editorView.contentInset
251241
var rightMargin = (view.frame.maxX - editorView.frame.maxX)
252-
if #available(iOS 11.0, *) {
253-
rightMargin -= view.safeAreaInsets.right
254-
}
242+
rightMargin -= view.safeAreaInsets.right
243+
255244
scrollInsets.right = -rightMargin
256245
editorView.scrollIndicatorInsets = scrollInsets
257246
}
@@ -499,6 +488,10 @@ extension EditorDemoController : UITextViewDelegate {
499488
return true
500489
}
501490

491+
func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
492+
return false
493+
}
494+
502495
func scrollViewDidScroll(_ scrollView: UIScrollView) {
503496
updateTitlePosition()
504497
}
@@ -798,9 +791,7 @@ extension EditorDemoController {
798791
textField.clearButtonMode = UITextField.ViewMode.always;
799792
textField.placeholder = NSLocalizedString("URL", comment:"URL text field placeholder");
800793
textField.keyboardType = .URL
801-
if #available(iOS 10, *) {
802-
textField.textContentType = .URL
803-
}
794+
textField.textContentType = .URL
804795
textField.text = urlToUse?.absoluteString
805796

806797
textField.addTarget(self,

WordPress-Aztec-iOS.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'WordPress-Aztec-iOS'
11-
s.version = '1.10.1'
11+
s.version = '1.11'
1212
s.summary = 'The native HTML Editor.'
1313

1414
# This description is used to generate tags and improve search results.
@@ -27,7 +27,7 @@ Pod::Spec.new do |s|
2727
s.author = { 'Automattic' => 'mobile@automattic.com', 'Diego Rey Mendez' => 'diego.rey.mendez@automattic.com', 'Sergio Estevao' => 'sergioestevao@gmail.com', 'Jorge Leandro Perez' => 'jorge.perez@automattic.com' }
2828
s.social_media_url = "http://twitter.com/WordPressiOS"
2929
s.source = { :git => 'https://github.com/wordpress-mobile/WordPress-Aztec-iOS.git', :tag => s.version.to_s }
30-
s.ios.deployment_target = '10.0'
30+
s.ios.deployment_target = '11.0'
3131
s.swift_version = '5.0'
3232

3333
s.module_name = "Aztec"

WordPress-Editor-iOS.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'WordPress-Editor-iOS'
11-
s.version = '1.10.1'
11+
s.version = '1.11'
1212
s.summary = 'The WordPress HTML Editor.'
1313

1414
# This description is used to generate tags and improve search results.
@@ -27,7 +27,7 @@ Pod::Spec.new do |s|
2727
s.author = { 'Automattic' => 'mobile@automattic.com', 'Diego Rey Mendez' => 'diego.rey.mendez@automattic.com', 'Sergio Estevao' => 'sergioestevao@gmail.com', 'Jorge Leandro Perez' => 'jorge.perez@automattic.com' }
2828
s.social_media_url = "http://twitter.com/WordPressiOS"
2929
s.source = { :git => 'https://github.com/wordpress-mobile/WordPress-Aztec-iOS.git', :tag => s.version.to_s }
30-
s.ios.deployment_target = '10.0'
30+
s.ios.deployment_target = '11.0'
3131
s.swift_version = '5.0'
3232

3333
s.module_name = "WordPressEditor"

0 commit comments

Comments
 (0)