Skip to content

Commit 8998758

Browse files
committed
Release 1.0.0
1 parent 02f8337 commit 8998758

File tree

3 files changed

+25
-132
lines changed

3 files changed

+25
-132
lines changed

AppStoreVersion.podspec

Lines changed: 3 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,16 @@
1-
#
2-
# Be sure to run `pod spec lint AppVersionChecker.podspec' to ensure this is a
3-
# valid spec and to remove all comments including this before submitting the spec.
4-
#
5-
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
6-
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
7-
#
8-
91
Pod::Spec.new do |s|
10-
11-
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
12-
#
13-
# These will help people to find your library, and whilst it
14-
# can feel like a chore to fill in it's definitely to your advantage. The
15-
# summary should be tweet-length, and the description more in depth.
16-
#
17-
182
s.name = "AppStoreVersion"
193
s.version = "1.0.0"
204
s.summary = "An easy Swift framework to check your latest app version available on the AppStore and compare it to the installed version"
21-
22-
# This description is used to generate tags and improve search results.
23-
# * Think: What does it do? Why did you write it? What is the focus?
24-
# * Try to keep it short, snappy and to the point.
25-
# * Write the description between the DESC delimiters below.
26-
# * Finally, don't worry about the indent, CocoaPods strips it!
275
s.description = <<-DESC
286
An easy Swift framework to check your latest app version available on the AppStore and compare it to the installed version.
297
DESC
30-
318
s.homepage = "https://github.com/iMac0de/AppStoreVersion/blob/master/README.md"
32-
# s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
33-
34-
35-
# ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
36-
#
37-
# Licensing your code is important. See http://choosealicense.com for more info.
38-
# CocoaPods will detect a license file if there is a named LICENSE*
39-
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
40-
#
41-
429
s.license = "MIT"
43-
# s.license = { :type => "MIT", :file => "LICENSE" }
44-
45-
46-
# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
47-
#
48-
# Specify the authors of the library, with email addresses. Email addresses
49-
# of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
50-
# accepts just a name if you'd rather not provide an email address.
51-
#
52-
# Specify a social_media_url where others can refer to, for example a twitter
53-
# profile URL.
54-
#
55-
5610
s.author = { "iMac0de" => "[email protected]" }
57-
# Or just: s.author = "iMac0de"
58-
# s.authors = { "iMac0de" => "[email protected]" }
59-
# s.social_media_url = "http://twitter.com/iMac0de"
60-
61-
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
62-
#
63-
# If this Pod runs only on iOS or OS X, then specify the platform and
64-
# the deployment target. You can optionally include the target after the platform.
65-
#
66-
67-
# s.platform = :ios
6811
s.platform = :ios, "10.0"
69-
70-
# When using multiple platforms
71-
# s.ios.deployment_target = "5.0"
72-
# s.osx.deployment_target = "10.7"
73-
# s.watchos.deployment_target = "2.0"
74-
# s.tvos.deployment_target = "9.0"
75-
76-
77-
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
78-
#
79-
# Specify the location from where the source should be retrieved.
80-
# Supports git, hg, bzr, svn and HTTP.
81-
#
82-
83-
s.source = { :git => "https://github.com/iMac0de/AppVersionChecker.git", :tag => "#{s.version}" }
84-
85-
86-
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
87-
#
88-
# CocoaPods is smart about how it includes source code. For source files
89-
# giving a folder will include any swift, h, m, mm, c & cpp files.
90-
# For header files it will include any header in the folder.
91-
# Not including the public_header_files will make all headers public.
92-
#
93-
94-
s.source_files = "AppVersionChecker", "AppVersionChecker/*.{h,m,swift}"
95-
96-
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
97-
#
98-
# A list of resources included with the Pod. These are copied into the
99-
# target bundle with a build phase script. Anything else will be cleaned.
100-
# You can preserve files from being cleaned, please don't preserve
101-
# non-essential files like tests, examples and documentation.
102-
#
103-
104-
# s.resource = "icon.png"
105-
# s.resources = "Resources/*.png"
106-
107-
# s.preserve_paths = "FilesToSave", "MoreFilesToSave"
108-
109-
110-
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
111-
#
112-
# Link your library with frameworks, or libraries. Libraries do not include
113-
# the lib prefix of their name.
114-
#
115-
116-
# s.framework = "SomeFramework"
117-
# s.frameworks = "SomeFramework", "AnotherFramework"
118-
119-
# s.library = "iconv"
120-
# s.libraries = "iconv", "xml2"
121-
122-
123-
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
124-
#
125-
# If your library depends on compiler flags you can set them in the xcconfig hash
126-
# where they will only apply to your library. If you depend on other Podspecs
127-
# you can include multiple dependencies to ensure it works.
128-
129-
# s.requires_arc = true
130-
131-
# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
12+
s.source = { :git => "https://github.com/iMac0de/AppStoreVersion.git", :tag => "#{s.version}" }
13+
s.source_files = "AppStoreVersion", "AppStoreVersion/*.{h,m,swift}"
14+
s.resource_bundle = { "Localizable" => "AppStoreVersion/*.lproj/*.strings" }
13215
s.dependency "Alamofire"
133-
13416
end

AppStoreVersion/AppStoreVersion.swift

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ import Alamofire
1111

1212
open class AppStoreVersion {
1313

14+
private static var appStoreVersionBundle: Bundle {
15+
let path = Bundle(for: AppStoreVersion.self).path(forResource: "Localizable", ofType: "bundle")!
16+
let bundle = Bundle(path: path) ?? Bundle.main
17+
return bundle
18+
}
19+
20+
private class var version: String {
21+
return Bundle.main.infoDictionary!["CFBundleShortVersionString"] as! String
22+
}
23+
24+
private static var cache: [String: Any]? = nil
25+
1426
struct Keys {
1527
static let kAppStoreResultsKey = "results"
1628
static let kAppStoreVersionKey = "version"
@@ -20,16 +32,14 @@ open class AppStoreVersion {
2032
public struct Config {
2133
public static var optional: Bool = true
2234
public struct Alert {
23-
public static var title: String = NSLocalizedString("AppStoreVersion.NewVersionTitle", comment: "")
24-
public static var message: String = NSLocalizedString("AppStoreVersion.NewVersionMessage", comment: "")
25-
public static var downloadActionTitle: String = NSLocalizedString("AppStoreVersion.Download", comment: "")
26-
public static var laterActionTitle: String = NSLocalizedString("AppStoreVersion.Later", comment: "")
35+
public static var title: String = NSLocalizedString("AppStoreVersion.NewVersionTitle", tableName: nil, bundle: appStoreVersionBundle, value: "", comment: "")
36+
public static var message: String = NSLocalizedString("AppStoreVersion.NewVersionMessage", tableName: nil, bundle: appStoreVersionBundle, value: "", comment: "")
37+
public static var downloadActionTitle: String = NSLocalizedString("AppStoreVersion.Download", tableName: nil, bundle: appStoreVersionBundle, value: "", comment: "")
38+
public static var laterActionTitle: String = NSLocalizedString("AppStoreVersion.Later", tableName: nil, bundle: appStoreVersionBundle, value: "", comment: "")
2739
}
2840
}
2941

30-
private class var version: String {
31-
return Bundle.main.infoDictionary!["CFBundleShortVersionString"] as! String
32-
}
42+
public static var latestVersionAvailable: String = ""
3343

3444
private class func endpoint(for bundle: Bundle) -> URL? {
3545
if let identifier = bundle.bundleIdentifier {
@@ -43,10 +53,6 @@ open class AppStoreVersion {
4353
return nil
4454
}
4555

46-
private static var cache: [String: Any]? = nil
47-
48-
public static var latestVersionAvailable: String = ""
49-
5056
/**
5157
This method can be used to check if the param bundle version is the latest version available on the AppStore corresponding to the param bundle identifier. It will manage the display of an `UIAlertController` with an `UIAlertAction` to download the latest version if needed.
5258

AppStoreVersion/Info.plist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
1111
<key>CFBundleInfoDictionaryVersion</key>
1212
<string>6.0</string>
13+
<key>CFBundleLocalizations</key>
14+
<array>
15+
<string>en</string>
16+
<string>fr</string>
17+
</array>
1318
<key>CFBundleName</key>
1419
<string>$(PRODUCT_NAME)</string>
1520
<key>CFBundlePackageType</key>

0 commit comments

Comments
 (0)