From 337c302d2a07d7d9deaf920f55817713d6cca904 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Fri, 29 Jun 2018 15:49:06 +0700 Subject: [PATCH] Meta tweaks --- .gitattributes | 3 +-- Configs/Defaults.plist | 6 ------ Configs/DefaultsTests.plist | 4 ---- Defaults.podspec | 6 +++--- Defaults.xcodeproj/project.pbxproj | 1 - Package.swift | 30 +++++++++++++++++------------- Sources/Defaults.swift | 10 ++++++---- readme.md | 3 ++- 8 files changed, 29 insertions(+), 34 deletions(-) diff --git a/.gitattributes b/.gitattributes index 9ed337d..6313b56 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1 @@ -* text=auto -*.swift text eol=lf +* text=auto eol=lf diff --git a/Configs/Defaults.plist b/Configs/Defaults.plist index 134d134..367e9b0 100644 --- a/Configs/Defaults.plist +++ b/Configs/Defaults.plist @@ -2,8 +2,6 @@ - CFBundleDevelopmentRegion - en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -16,13 +14,9 @@ FMWK CFBundleShortVersionString 0.2.2 - CFBundleSignature - ???? CFBundleVersion $(CURRENT_PROJECT_VERSION) NSHumanReadableCopyright MIT License © Sindre Sorhus - NSPrincipalClass - diff --git a/Configs/DefaultsTests.plist b/Configs/DefaultsTests.plist index 9841296..5ad566d 100644 --- a/Configs/DefaultsTests.plist +++ b/Configs/DefaultsTests.plist @@ -2,8 +2,6 @@ - CFBundleDevelopmentRegion - en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -16,8 +14,6 @@ BNDL CFBundleShortVersionString 0.0.0 - CFBundleSignature - ???? CFBundleVersion 1 diff --git a/Defaults.podspec b/Defaults.podspec index b73f889..1dd7095 100644 --- a/Defaults.podspec +++ b/Defaults.podspec @@ -1,15 +1,15 @@ Pod::Spec.new do |s| s.name = 'Defaults' s.version = '0.2.2' - s.license = { :type => 'MIT', :file => 'license' } + s.summary = 'Swifty and modern UserDefaults' + s.license = 'MIT' s.homepage = 'https://github.com/sindresorhus/Defaults' s.social_media_url = 'https://twitter.com/sindresorhus' s.authors = { 'Sindre Sorhus' => 'sindresorhus@gmail.com' } - s.summary = 'Swifty and modern UserDefaults' s.source = { :git => 'https://github.com/sindresorhus/Defaults.git', :tag => "v#{s.version}" } s.source_files = 'Sources/*.swift' s.swift_version = '4.1' - s.osx.deployment_target = '10.12' + s.macos.deployment_target = '10.12' s.ios.deployment_target = '10.0' s.tvos.deployment_target = '10.0' s.watchos.deployment_target = '3.0' diff --git a/Defaults.xcodeproj/project.pbxproj b/Defaults.xcodeproj/project.pbxproj index 66ad83f..63f64ad 100644 --- a/Defaults.xcodeproj/project.pbxproj +++ b/Defaults.xcodeproj/project.pbxproj @@ -385,7 +385,6 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( - en, ); mainGroup = 52D6D9721BEFF229002C0205; productRefGroup = 52D6D97D1BEFF229002C0205 /* Products */; diff --git a/Package.swift b/Package.swift index c2887e7..a389904 100644 --- a/Package.swift +++ b/Package.swift @@ -2,20 +2,24 @@ import PackageDescription let package = Package( - name: "Defaults", - products: [ - .library( - name: "Defaults", - targets: ["Defaults"] + name: "Defaults", + products: [ + .library( + name: "Defaults", + targets: [ + "Defaults" + ] ) - ], - targets: [ - .target( - name: "Defaults" + ], + targets: [ + .target( + name: "Defaults" ), - .testTarget( - name: "DefaultsTests", - dependencies: ["Defaults"] + .testTarget( + name: "DefaultsTests", + dependencies: [ + "Defaults" + ] ) - ] + ] ) diff --git a/Sources/Defaults.swift b/Sources/Defaults.swift index d10dd2f..6e55ca6 100644 --- a/Sources/Defaults.swift +++ b/Sources/Defaults.swift @@ -52,15 +52,17 @@ public final class Defaults { // Has to be `defaults` lowercase until Swift supports static subscripts… public let defaults = Defaults() -public extension UserDefaults { +extension UserDefaults { private func _get(_ key: String) -> T? { if isNativelySupportedType(T.self) { return object(forKey: key) as? T } - guard let text = string(forKey: key), - let data = "[\(text)]".data(using: .utf8) else { - return nil + guard + let text = string(forKey: key), + let data = "[\(text)]".data(using: .utf8) + else { + return nil } do { diff --git a/readme.md b/readme.md index 6846d44..213a273 100644 --- a/readme.md +++ b/readme.md @@ -35,7 +35,7 @@ github "sindresorhus/Defaults" #### CocoaPods -``` +```ruby pod 'Defaults' ``` @@ -172,6 +172,7 @@ It's inspired by it and other solutions. The main difference is that this module ## Related +- [Preferences](https://github.com/sindresorhus/Preferences) - Add a preferences window to your macOS app in minutes - [LaunchAtLogin](https://github.com/sindresorhus/LaunchAtLogin) - Add "Launch at Login" functionality to your macOS app - [DockProgress](https://github.com/sindresorhus/DockProgress) - Show progress in your app's Dock icon - [Gifski](https://github.com/sindresorhus/gifski-app) - Convert videos to high-quality GIFs on your Mac