Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Aug 28, 2018
1 parent 4da9398 commit 337c302
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 34 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* text=auto
*.swift text eol=lf
* text=auto eol=lf
6 changes: 0 additions & 6 deletions Configs/Defaults.plist
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
4 changes: 0 additions & 4 deletions Configs/DefaultsTests.plist
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
6 changes: 3 additions & 3 deletions Defaults.podspec
Original file line number Diff line number Diff line change
@@ -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' => '[email protected]' }
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'
Expand Down
1 change: 0 additions & 1 deletion Defaults.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 52D6D9721BEFF229002C0205;
productRefGroup = 52D6D97D1BEFF229002C0205 /* Products */;
Expand Down
30 changes: 17 additions & 13 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
)
]
]
)
10 changes: 6 additions & 4 deletions Sources/Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ github "sindresorhus/Defaults"

#### CocoaPods

```
```ruby
pod 'Defaults'
```

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 337c302

Please sign in to comment.