Meta tweaks

This commit is contained in:
Sindre Sorhus 2018-06-29 15:49:06 +07:00
parent 4da93984a4
commit 337c302d2a
8 changed files with 29 additions and 34 deletions

3
.gitattributes vendored
View File

@ -1,2 +1 @@
* text=auto * text=auto eol=lf
*.swift text eol=lf

View File

@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
@ -16,13 +14,9 @@
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.2.2</string> <string>0.2.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string> <string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>MIT License © Sindre Sorhus</string> <string>MIT License © Sindre Sorhus</string>
<key>NSPrincipalClass</key>
<string></string>
</dict> </dict>
</plist> </plist>

View File

@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
@ -16,8 +14,6 @@
<string>BNDL</string> <string>BNDL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.0.0</string> <string>0.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1</string> <string>1</string>
</dict> </dict>

View File

@ -1,15 +1,15 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Defaults' s.name = 'Defaults'
s.version = '0.2.2' 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.homepage = 'https://github.com/sindresorhus/Defaults'
s.social_media_url = 'https://twitter.com/sindresorhus' s.social_media_url = 'https://twitter.com/sindresorhus'
s.authors = { 'Sindre Sorhus' => 'sindresorhus@gmail.com' } 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 = { :git => 'https://github.com/sindresorhus/Defaults.git', :tag => "v#{s.version}" }
s.source_files = 'Sources/*.swift' s.source_files = 'Sources/*.swift'
s.swift_version = '4.1' s.swift_version = '4.1'
s.osx.deployment_target = '10.12' s.macos.deployment_target = '10.12'
s.ios.deployment_target = '10.0' s.ios.deployment_target = '10.0'
s.tvos.deployment_target = '10.0' s.tvos.deployment_target = '10.0'
s.watchos.deployment_target = '3.0' s.watchos.deployment_target = '3.0'

View File

@ -385,7 +385,6 @@
developmentRegion = English; developmentRegion = English;
hasScannedForEncodings = 0; hasScannedForEncodings = 0;
knownRegions = ( knownRegions = (
en,
); );
mainGroup = 52D6D9721BEFF229002C0205; mainGroup = 52D6D9721BEFF229002C0205;
productRefGroup = 52D6D97D1BEFF229002C0205 /* Products */; productRefGroup = 52D6D97D1BEFF229002C0205 /* Products */;

View File

@ -6,7 +6,9 @@ let package = Package(
products: [ products: [
.library( .library(
name: "Defaults", name: "Defaults",
targets: ["Defaults"] targets: [
"Defaults"
]
) )
], ],
targets: [ targets: [
@ -15,7 +17,9 @@ let package = Package(
), ),
.testTarget( .testTarget(
name: "DefaultsTests", name: "DefaultsTests",
dependencies: ["Defaults"] dependencies: [
"Defaults"
]
) )
] ]
) )

View File

@ -52,14 +52,16 @@ public final class Defaults {
// Has to be `defaults` lowercase until Swift supports static subscripts // Has to be `defaults` lowercase until Swift supports static subscripts
public let defaults = Defaults() public let defaults = Defaults()
public extension UserDefaults { extension UserDefaults {
private func _get<T: Codable>(_ key: String) -> T? { private func _get<T: Codable>(_ key: String) -> T? {
if isNativelySupportedType(T.self) { if isNativelySupportedType(T.self) {
return object(forKey: key) as? T return object(forKey: key) as? T
} }
guard let text = string(forKey: key), guard
let data = "[\(text)]".data(using: .utf8) else { let text = string(forKey: key),
let data = "[\(text)]".data(using: .utf8)
else {
return nil return nil
} }

View File

@ -35,7 +35,7 @@ github "sindresorhus/Defaults"
#### CocoaPods #### CocoaPods
``` ```ruby
pod 'Defaults' pod 'Defaults'
``` ```
@ -172,6 +172,7 @@ It's inspired by it and other solutions. The main difference is that this module
## Related ## 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 - [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 - [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 - [Gifski](https://github.com/sindresorhus/gifski-app) - Convert videos to high-quality GIFs on your Mac