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
*.swift text eol=lf
* text=auto 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">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@ -16,13 +14,9 @@
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.2.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
<string>MIT License © Sindre Sorhus</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</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">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@ -16,8 +14,6 @@
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>

View File

@ -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'

View File

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

View File

@ -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"
]
)
]
]
)

View File

@ -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<T: Codable>(_ 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 {

View File

@ -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