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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Examples/iOS Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
Expand Down
31 changes: 16 additions & 15 deletions SwiftyAcknowledgements.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@
TargetAttributes = {
5270467A1BE203CB004CD4FC = {
CreatedOnToolsVersion = 7.1;
LastSwiftMigration = 0820;
LastSwiftMigration = 1020;
};
527046891BE204A1004CD4FC = {
CreatedOnToolsVersion = 7.1;
Expand All @@ -481,11 +481,11 @@
};
52FC37761B9F6A0A005EFE87 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0820;
LastSwiftMigration = 1020;
};
52FC378C1B9F6BEF005EFE87 = {
CreatedOnToolsVersion = 7.0;
LastSwiftMigration = 0820;
LastSwiftMigration = 1020;
};
};
};
Expand All @@ -494,6 +494,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -747,7 +748,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "de.mathiasnagler.SwiftyAcknowledgementsTests-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -759,7 +760,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "de.mathiasnagler.SwiftyAcknowledgementsTests-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -771,7 +772,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "de.mathiasnagler.SwiftyAcknowledgements-tvOS-Tests";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Debug;
Expand All @@ -784,7 +785,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "de.mathiasnagler.SwiftyAcknowledgements-tvOS-Tests";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
name = Release;
Expand All @@ -804,7 +805,7 @@
PRODUCT_NAME = SwiftyAcknowledgements;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand All @@ -825,7 +826,7 @@
PRODUCT_NAME = SwiftyAcknowledgements;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand All @@ -842,7 +843,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "de.mathiasnagler.tvOS-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand All @@ -859,7 +860,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "de.mathiasnagler.tvOS-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 9.0;
};
Expand Down Expand Up @@ -975,7 +976,7 @@
PRODUCT_NAME = SwiftyAcknowledgements;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -995,7 +996,7 @@
PRODUCT_NAME = SwiftyAcknowledgements;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -1008,7 +1009,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "de.mathiasnagler.iOS-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -1022,7 +1023,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "de.mathiasnagler.iOS-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
4 changes: 2 additions & 2 deletions SwiftyAcknowledgements/AcknowledgementViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal class AcknowledgementViewController: UIViewController {
// MARK: Properties

/// The font size used for displaying the acknowledgement's text
internal var fontSize: CGFloat = UIFontDescriptor.preferredFontSize(withTextStyle: UIFontTextStyle.body.rawValue) {
internal var fontSize: CGFloat = UIFontDescriptor.preferredFontSize(withTextStyle: UIFont.TextStyle.body.rawValue) {
didSet {
textView.font = UIFont.systemFont(ofSize: fontSize)
}
Expand All @@ -28,7 +28,7 @@ internal class AcknowledgementViewController: UIViewController {
textView.translatesAutoresizingMaskIntoConstraints = false
textView.alwaysBounceVertical = true
textView.font = UIFont.systemFont(ofSize: self.fontSize)
textView.textContainerInset = UIEdgeInsetsMake(12, 10, 12, 10)
textView.textContainerInset = UIEdgeInsets.init(top: 12, left: 10, bottom: 12, right: 10)
textView.isUserInteractionEnabled = true

#if os(iOS)
Expand Down
14 changes: 7 additions & 7 deletions SwiftyAcknowledgements/AcknowledgementsTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ public class AcknowledgementsTableViewController: UITableViewController {
}

/// The font size to be used for the **UITableView**'s **tableHeader**. Defaults to the size of **UIFontTextStyleSubheadline**
@IBInspectable public var headerFontSize: CGFloat = UIFontDescriptor.preferredFontSize(withTextStyle: UIFontTextStyle.subheadline.rawValue) {
@IBInspectable public var headerFontSize: CGFloat = UIFontDescriptor.preferredFontSize(withTextStyle: UIFont.TextStyle.subheadline.rawValue) {
didSet {
headerView.fontSize = headerFontSize
updateHeaderFooterViews()
}
}

/// The font size to be used for the **UITableView**'s **tableFooter**. Defaults to the size of **UIFontTextStyleSubheadline**
@IBInspectable public var footerFontSize: CGFloat = UIFontDescriptor.preferredFontSize(withTextStyle: UIFontTextStyle.subheadline.rawValue) {
@IBInspectable public var footerFontSize: CGFloat = UIFontDescriptor.preferredFontSize(withTextStyle: UIFont.TextStyle.subheadline.rawValue) {
didSet {
footerView.fontSize = footerFontSize
updateHeaderFooterViews()
}
}

/// The font size to be used for the **UITableView**'s cells. Defaults to the size of **UIFontTextStyleBody**
@IBInspectable public var detailFontSize: CGFloat = UIFontDescriptor.preferredFontSize(withTextStyle: UIFontTextStyle.body.rawValue)
@IBInspectable public var detailFontSize: CGFloat = UIFontDescriptor.preferredFontSize(withTextStyle: UIFont.TextStyle.body.rawValue)

/// The name of the plist containing the acknowledgements, defaults to **Acknowledgements**.
@IBInspectable public var acknowledgementsPlistName = "Acknowledgements"
Expand Down Expand Up @@ -178,17 +178,17 @@ public class AcknowledgementsTableViewController: UITableViewController {

private func updateHeaderFooterViews(forWidth width: CGFloat) {
let headerWidthConstraint = NSLayoutConstraint(item: headerView, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: width)
headerWidthConstraint.priority = 999
headerWidthConstraint.priority = UILayoutPriority(999)
headerWidthConstraint.isActive = true
let headerHeight = headerView.systemLayoutSizeFitting(UILayoutFittingCompressedSize).height
let headerHeight = headerView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height
headerWidthConstraint.isActive = false
headerView.frame = CGRect(x: 0, y: 0, width: width, height: headerHeight)
tableView.tableHeaderView = headerView

let footerWidthConstraint = NSLayoutConstraint(item: footerView, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: width)
footerWidthConstraint.priority = 999
footerWidthConstraint.priority = UILayoutPriority(999)
footerWidthConstraint.isActive = true
let footerHeight = footerView.systemLayoutSizeFitting(UILayoutFittingCompressedSize).height
let footerHeight = footerView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).height
footerWidthConstraint.isActive = false
footerView.frame = CGRect(x: 0, y: 0, width: width, height: footerHeight)
tableView.tableFooterView = footerView
Expand Down
3 changes: 2 additions & 1 deletion SwiftyAcknowledgements/UIFontDescriptorExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
//

import Foundation
import UIKit

internal extension UIFontDescriptor {

/// Returns the point-size of the preffered font for a text style
/// The user can influence this value by changing the font-size setting
internal class func preferredFontSize(withTextStyle style: String) -> CGFloat {
let style = self.preferredFontDescriptor(withTextStyle: UIFontTextStyle(rawValue: style))
let style = self.preferredFontDescriptor(withTextStyle: UIFont.TextStyle(rawValue: style))
return style.pointSize
}

Expand Down