9 Commits

Author SHA1 Message Date
Simon Blommegård fd87cc857a Version bump to 2.2 2019-03-26 14:19:29 +01:00
Simon Blommegård 776b5738d6 More Swift 5 migration 2019-03-26 14:05:23 +01:00
Hannes Ljungberg 2960e987b0 Migrate to Swift 5 (#68)
* Upgrade to recommended settings

* Swift 5 migration

* Run tests on latest xcode

* Update fixtures
2019-03-26 14:01:36 +01:00
Simon Blommegård 4408c2dab3 Swift 4 migration of demo. 2018-02-06 14:33:45 +01:00
Simon Blommegård ba7bb956a4 Fixing travis config. 2017-12-12 10:02:41 +01:00
Simon Blommegård eabd1307c8 Version bump to 2.1 2017-12-11 15:09:09 +01:00
Simon Blommegård 0daff70461 Updating travis config. 2017-12-11 14:55:11 +01:00
Simon Blommegård c024e356bf New fixtures generated 2017-12-11 14:53:30 +01:00
Simon Blommegård e044a46c0e Swift 4 migration 2017-12-11 14:53:11 +01:00
40 changed files with 116 additions and 43 deletions
+4 -4
View File
@@ -1,10 +1,10 @@
language: objective-c
osx_image: xcode8.3
osx_image: xcode10.2
env:
- "DESTINATION='platform=iOS Simulator,name=iPhone 7' ACTION=test"
- "DESTINATION='platform=OS X' ACTION=test"
- "DESTINATION='platform=tvOS Simulator,name=Apple TV 1080p' ACTION=test"
- "DESTINATION='OS=12.2,platform=iOS Simulator,name=iPhone 8' ACTION=test"
- "DESTINATION='platform=macOS' ACTION=test"
- "DESTINATION='OS=12.2,platform=tvOS Simulator,name=Apple TV' ACTION=test"
script:
- set -o pipefail && xcodebuild -project Sources/Swift/FlagKit.xcodeproj -scheme FlagKit -destination "$DESTINATION" $ACTION | xcpretty
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "FlagKit"
s.version = "2.0.1"
s.version = "2.2"
s.summary = "Beautiful flag icons for usage in apps and on the web."
s.homepage = "https://github.com/madebybowtie/FlagKit"
+65 -10
View File
@@ -260,28 +260,29 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = Bowtie;
TargetAttributes = {
3A49DD801F2F63F90007E46E = {
CreatedOnToolsVersion = 8.3.2;
LastSwiftMigration = 0830;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
3A59879C1F306C260097DB64 = {
CreatedOnToolsVersion = 8.3.2;
LastSwiftMigration = 0830;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
3AF78CE01F31CE0400BD3D10 = {
CreatedOnToolsVersion = 8.3.2;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
};
};
buildConfigurationList = 3A49DD5E1F2F62D10007E46E /* Build configuration list for PBXProject "FlagKit" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
@@ -393,12 +394,66 @@
3A49DD5F1F2F62D10007E46E /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
};
name = Debug;
};
3A49DD601F2F62D10007E46E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
};
name = Release;
};
@@ -464,7 +519,7 @@
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -525,7 +580,7 @@
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 10.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -585,7 +640,7 @@
SDKROOT = macosx;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -634,7 +689,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
@@ -692,7 +747,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -742,7 +797,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
@@ -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>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
+6 -6
View File
@@ -15,18 +15,18 @@ public class Flag: NSObject {
/**
Country code of the flag
*/
public let countryCode: String
@objc public let countryCode: String
#if os(iOS) || os(tvOS)
/**
Original unstyled flag image
*/
public let originalImage: UIImage
@objc public let originalImage: UIImage
/**
Returns a flag if the country code is supported, otherwise it returns nil
*/
public init?(countryCode: String) {
@objc public init?(countryCode: String) {
guard let image = UIImage(named: countryCode, in: FlagKit.assetBundle, compatibleWith: nil) else {
return nil
}
@@ -39,7 +39,7 @@ public class Flag: NSObject {
Returns a styled flag according to the provided style
- parameter style: Desired flag style
*/
public func image(style: FlagStyle) -> UIImage {
@objc public func image(style: FlagStyle) -> UIImage {
return originalImage.rendereredImage(size: style.size, action: { (context) in
switch style {
case .none:
@@ -60,12 +60,12 @@ public class Flag: NSObject {
/**
Original unstyled flag image
*/
public let originalImage: NSImage
@objc public let originalImage: NSImage
/**
Returns a flag if the country code is supported, otherwise it returns nil
*/
public init?(countryCode: String) {
@objc public init?(countryCode: String) {
guard let image = FlagKit.assetBundle.image(forResource: countryCode) else {
return nil
}
+1 -1
View File
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.0</string>
<string>2.2</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
@@ -8,7 +8,7 @@ import UIKit
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 {
window = UIWindow(frame: UIScreen.main.bounds)
window?.tintColor = UIColor(red: 0.02, green: 0.67, blue: 0.73, alpha: 1.0)
window?.rootViewController = UINavigationController(rootViewController: FlagsListViewController())
@@ -16,4 +16,3 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return true
}
}
@@ -39,6 +39,11 @@
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
@@ -7,15 +7,15 @@ import UIKit
class FlagTableViewCell: UITableViewCell {
static let identifier = "FlagTableViewCell"
override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: .value1, reuseIdentifier: reuseIdentifier)
backgroundColor = UIColor.clear
textLabel?.font = UIFont.systemFont(ofSize: 15, weight: UIFontWeightMedium)
textLabel?.font = UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.medium)
textLabel?.textColor = UIColor(red: 0.00, green: 0.15, blue: 0.16, alpha: 1.0)
detailTextLabel?.font = UIFont.systemFont(ofSize: 13, weight: UIFontWeightLight)
detailTextLabel?.font = UIFont.systemFont(ofSize: 13, weight: UIFont.Weight.light)
detailTextLabel?.textColor = UIColor(red: 0.00, green: 0.15, blue: 0.16, alpha: 1.0)
imageView?.contentMode = .center
@@ -2,17 +2,17 @@
"images" : [
{
"idiom" : "universal",
"filename" : "se-circle-1.png",
"filename" : "se-circle@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "se-circle.png",
"filename" : "se-circle@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "se-circle-2.png",
"filename" : "se-circle@3x.png",
"scale" : "3x"
}
],
Binary file not shown.

Before

Width:  |  Height:  |  Size: 913 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

@@ -2,17 +2,17 @@
"images" : [
{
"idiom" : "universal",
"filename" : "se-none-1.png",
"filename" : "se-none@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "se-none.png",
"filename" : "se-none@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "se-none-2.png",
"filename" : "se-none@3x.png",
"scale" : "3x"
}
],
Binary file not shown.

Before

Width:  |  Height:  |  Size: 838 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -2,17 +2,17 @@
"images" : [
{
"idiom" : "universal",
"filename" : "se-roundrect.png",
"filename" : "se-roundedrect@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "se-roundedrect.png",
"filename" : "se-roundedrect@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "se-roundedrect-1.png",
"filename" : "se-roundedrect@3x.png",
"scale" : "3x"
}
],
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 894 B

@@ -2,17 +2,17 @@
"images" : [
{
"idiom" : "universal",
"filename" : "se-square-1.png",
"filename" : "se-square@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "se-square.png",
"filename" : "se-square@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "se-square-2.png",
"filename" : "se-square@3x.png",
"scale" : "3x"
}
],
Binary file not shown.

Before

Width:  |  Height:  |  Size: 768 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 930 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

+7 -1
View File
@@ -31,7 +31,13 @@ class FlagTests: XCTestCase {
func testRoundedRectImage() {
let generated = Flag(countryCode: "SE")?.image(style: .roundedRect)
XCTAssertNotNil(generated)
let file = generated!.pngData()
let dir = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first!.appending("flag.png")
try! file?.write(to: URL(fileURLWithPath: dir))
let fixture = fixtureImage(named: "se-roundedrect")
XCTAssertImageEqual(generated!, fixture)
}
+2 -2
View File
@@ -9,8 +9,8 @@ import XCTest
import UIKit
func XCTAssertImageEqual(_ lhs: UIImage, _ rhs: UIImage, file: StaticString = #file, line: UInt = #line) {
let lhsData = UIImagePNGRepresentation(lhs)
let rhsData = UIImagePNGRepresentation(rhs)
let lhsData = lhs.pngData()
let rhsData = rhs.pngData()
XCTAssertNotNil(lhsData, file: file, line: line)
XCTAssertNotNil(rhsData, file: file, line: line)
XCTAssertEqual(lhsData, rhsData, file: file, line: line)