๐Ÿ” Browse and edit UserDefaults on your app

Overview

UserDefaults-Browser

Browse and edit UserDefaults on your app. (SwiftUI or UIKit)

Browse Edit (as JSON) Edit (Date) Export
image image image image

Note:

We recommend to use SwiftUI-Simulator, if you use it in an app built with SwiftUI.
(This feature is also included)

Supported Types

  • Property List Types
    • Array
    • Dictionary
    • String
    • Date
    • Int
    • Float
    • Double
    • Bool
  • Other
    • URL
    • UIImage (Read-only)
  • JSON encoded
    • Data
    • String

AppGroups (UserDefaults(suiteName: "group.xxx")) is also supported, please see Configurations.

Quick Start

  1. Add https://github.com/YusukeHosonuma/UserDefaultsBrowser in the Xcode or Package.swift:
let package = Package(
    dependencies: [
        .package(url: "https://github.com/YusukeHosonuma/UserDefaultsBrowser", from: "1.0.0"),
    ],
    targets: [
        .target(name: "<your-target-name>", dependencies: [
             "UserDefaultsBrowser",
        ]),
    ]
)
  1. Setup launcher button.

SwiftUI: Surround the root view with UserDefaultsBrowserContainer.

import UserDefaultsBrowser

@main
struct ExampleApp: App {
    var body: some Scene {
        WindowGroup {
            UserDefaultsBrowserContainer {
                ContentView() // ๐Ÿ’ก Your root view.
            }
        }
    }
}

UIKit: Call setupUserDefaultsBrowserLauncher in viewDidLoad of your root ViewController.

import UserDefaultsBrowser

class ViewController: UIViewController { // ๐Ÿ’ก Your root ViewController.

    override func viewDidLoad() {
        super.viewDidLoad()

        UserDefaultsBrowser.setupUserDefaultsBrowserLauncher()
    }
}
  1. Tap launcher button at leading bottom.

image

Configuration

Both SwiftUI and UIKit have the same options like follows.

UserDefaultsBrowserContainer(
    suiteNames: ["group.xxx"],                        // AppGroups IDs
    excludeKeys: { $0.hasPrefix("not-display-key") }, // Exclude keys
    accentColor: .orange,                             // Your favorite color (`UIColor` type in UIKit-based API)
    imageName: "wrench.and.screwdriver",              // SFSymbols name
    displayStyle: .fullScreen                         // `.sheet` or `.fullScreen`
)

Add to some View or ViewController

For example, for tab-based applications, it is useful to have a tab for browsing.

SwiftUI

var body: some View {
    TabView {
        ...
        UserDefaultsBrowserView()
            .tabItem {
                Label("Browser", systemImage: "externaldrive")
            }
    }
}

UIKit

class TabItemViewController: UIViewController {
    override func viewDidLoad() {
        let vc = UserDefaultsBrowserViewController()
        addChild(vc)
        view.addSubview(vc.view)
        vc.didMove(toParent: self)
        
        vc.view.translatesAutoresizingMaskIntoConstraints = false
        vc.view.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 0).isActive = true
        vc.view.rightAnchor.constraint(equalTo: view.rightAnchor, constant: 0).isActive = true
        vc.view.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
        vc.view.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0).isActive = true
    }
}

Requirements

  • iOS 14+

Contributions

Issues and PRs are welcome, even for minor improvements and corrections.

Author

Yusuke Hosonuma / @tobi462

You might also like...
An iOS app to lift the speed limit of your Cowboy Bike
An iOS app to lift the speed limit of your Cowboy Bike

Legal Notice 1. I am not resposible to anything worse that could happen to your bike because of this app 2. Be careful that lifting the 25km/h limit c

The hassle-free way to add Segment analytics to your Swift app (iOS/tvOS/watchOS/macOS/Linux).

Analytics-Swift The hassle-free way to add Segment analytics to your Swift app (iOS/tvOS/watchOS/macOS/Linux/iPadOS). Analytics helps you measure your

Which contacts changed outside your iOS app? Better CNContactStoreDidChange notification: get real changes, without the noise.

ContactsChangeNotifier Which contacts changed outside your iOS app? Better CNContactStoreDidChange notification: Get real changes, without the noise.

A GUI for dynamically creating NSPredicates at runtime to query data in your iOS app.
A GUI for dynamically creating NSPredicates at runtime to query data in your iOS app.

PredicateEditor PredicateEditor is a visual editor for creating and using NSPredicates for querying data in your app. PredicateEditor was inspired by

iScheduleYourDay is a watchOS 8.5 app that can help order your daily tasks
iScheduleYourDay is a watchOS 8.5 app that can help order your daily tasks

Currently developing an App for watchOS 8.5 to help order your tasks daily. The app is a simple approach to the actual Apple App Remainders to become an improved version of it

ObjectBox Swift - persisting your Swift objects superfast and simple
ObjectBox Swift - persisting your Swift objects superfast and simple

ObjectBox Swift ObjectBox is a superfast, light-weight object persistence framework. This Swift API seamlessly persists objects on-device for iOS and

Easy direct access to your database ๐ŸŽฏ

OHMySQL โ˜…โ˜… Every star is appreciated! โ˜…โ˜… The library supports Objective-C and Swift, iOS and macOS. You can connect to your remote MySQL database usin

Your Data Storage Troubleshooter ๐Ÿ› 
Your Data Storage Troubleshooter ๐Ÿ› 

Your Data Storage Troubleshooter ๐Ÿ›  Introduction StorageKit is a framework which reduces the complexity of managing a persistent layer. You can easily

A Generic CoreData Manager to accept any type of objects. Fastest way for adding a Database to your project.
A Generic CoreData Manager to accept any type of objects. Fastest way for adding a Database to your project.

QuickDB FileManager + CoreData โ—๏ธ Save and Retrieve any thing in JUST ONE line of code โ—๏ธ Fast usage dataBase to avoid struggling with dataBase comple

Comments
  • Update Package.resolved & .gitignore

    Update Package.resolved & .gitignore

    Two minor fixes ๐Ÿ˜ƒ

    1. Update Package.resolved https://github.com/YusukeHosonuma/UserDefaultsBrowser/commit/cac35d6ff6fed3dd4ca9ad8cfd69495a1fb05171

    When I build Example project, the diff for SwiftUI-Common is generated on Package.resolved. So I just committed the diff.

    2. Update .gitignore https://github.com/YusukeHosonuma/UserDefaultsBrowser/commit/66ef8810730495a925858dbff2474c4051cd1888

    .DS_Store was removed from .gitignore in https://github.com/YusukeHosonuma/UserDefaultsBrowser/pull/18. It is a little troublesome to make sure not to commit my local .DS_Store every time. Though this issue can be handled by approach like global .gitignore, I think it is not bad to re-add .DS_Store to .gitignore.

    opened by maiyama18 1
  • Add CI build of Example project

    Add CI build of Example project

    close #17

    As mentioned in #17, it's nice to make sure that public api of this package is not broken by building Example project for every PR. I added workflow to build both SwiftUI / UIKit versions of example apps.

    It might be better if comprehensive tests for the package is added and executed on CI, but for now I think simply building Example project as CI is good idea.

    I confirmed that this workflows works in my forked repository. https://github.com/maiyama18/UserDefaultsBrowser/actions/runs/2319719282

    opened by maiyama18 1
  • Use system color for default accent color

    Use system color for default accent color

    Thanks for creating awesome tool ๐Ÿ˜ƒ

    I tried UserDefaultsBrowser in my app, and noticed that UIKit version's accent color is a little bit hard to see in dark mode when used with default configuration. So I replaced the default accent color by system color to improve visibility especially in dark mode.

    | before | after | | --- | --- | | Simulator Screen Shot - iPhone 13 Pro - 2022-05-12 at 21 09 58 | Simulator Screen Shot - iPhone 13 Pro - 2022-05-12 at 21 10 08 |

    opened by maiyama18 1
  • iOS 15+ ใฎๅ ดๅˆใซใฏๆจ™ๆบ–ใฎๆคœ็ดขใƒใƒผใ‚’ๅˆฉ็”จใ—ใŸใ„ใ€‚

    iOS 15+ ใฎๅ ดๅˆใซใฏๆจ™ๆบ–ใฎๆคœ็ดขใƒใƒผใ‚’ๅˆฉ็”จใ—ใŸใ„ใ€‚

    SwiftUI 3.0 ใ‹ใ‚‰ใฎ searchable ใ‚’ๅˆฉ็”จใงใใ‚Œใฐใ€่‡ชๅ‹•็š„ใซ้š ใ‚Œใฆใใ‚ŒใŸใ‚Šใ—ใฆไพฟๅˆฉใใ†ใ€‚๏ผˆใชๆฐ—ใŒใ™ใ‚‹

    image

    ref: https://github.com/YusukeHosonuma/UserDefaultsBrowser/blob/main/Sources/UserDefaultsBrowser/View/SearchContainerView.swift

    enhancement 
    opened by YusukeHosonuma 0
Releases(1.0.2)
  • 1.0.2(May 13, 2022)

  • 1.0.1(May 13, 2022)

    What's Changed

    • improve: display image as max-width in iOS 15+ by @YusukeHosonuma in https://github.com/YusukeHosonuma/UserDefaultsBrowser/pull/13
    • Use system color for default accent color by @maiyama18 in https://github.com/YusukeHosonuma/UserDefaultsBrowser/pull/16

    New Contributors

    • @maiyama18 made their first contribution in https://github.com/YusukeHosonuma/UserDefaultsBrowser/pull/16

    Full Changelog: https://github.com/YusukeHosonuma/UserDefaultsBrowser/compare/1.0.0...1.0.1

    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(May 8, 2022)

Movies Information DataBase (Add - Delete - Edit - Search)

MoviesInformation Movies Information DataBase (Add - Delete - Edit - Search) This Code Provide Simple Program About Movies Information This Program Ca

Mohammad Jaha 2 Sep 15, 2021
Simple, Strongly Typed UserDefaults for iOS, macOS and tvOS

็ฎ€ไฝ“ไธญๆ–‡ DefaultsKit leverages Swift 4's powerful Codable capabilities to provide a Simple and Strongly Typed wrapper on top of UserDefaults. It uses less

Nuno Dias 1.4k Dec 26, 2022
Swifty and modern UserDefaults

Defaults Swifty and modern UserDefaults Store key-value pairs persistently across launches of your app. It uses NSUserDefaults underneath but exposes

Sindre Sorhus 1.3k Dec 31, 2022
Effortlessly synchronize UserDefaults over iCloud.

Zephyr ??๏ธ Effortlessly sync UserDefaults over iCloud About Zephyr synchronizes specific keys and/or all of your UserDefaults over iCloud using NSUbiq

Arthur Ariel Sabintsev 841 Dec 23, 2022
Modern interface to UserDefaults + Codable support

Default Modern interface to UserDefaults + Codable support What is Default? Default is a library that extends what UserDefaults can do by providing ex

Nicholas Maccharoli 475 Dec 20, 2022
Why not use UserDefaults to store Codable objects ๐Ÿ˜‰

tl;dr You love Swift's Codable protocol and use it everywhere, who doesn't! Here is an easy and very light way to store and retrieve -reasonable amoun

Omar Albeik 452 Oct 17, 2022
A lightweight wrapper over UserDefaults/NSUserDefaults with an additional layer of AES-256 encryption

SecureDefaults for iOS, macOS Requirements โ€ข Usage โ€ข Installation โ€ข Contributing โ€ข Acknowledgments โ€ข Contributing โ€ข Author โ€ข License SecureDefaults is

Victor Peschenkov 216 Dec 22, 2022
โš™๏ธย A tiny property wrapper for UserDefaults. Only 60 lines of code.

โš™๏ธ A tiny property wrapper for UserDefaults. Only 60 lines of code. import Persistent extension UserDefaults { // Optional property @Per

Mezhevikin Alexey 6 Sep 28, 2022
PJAlertView - This library is to make your own custom alert views to match your apps look and feel

PJAlertView - This library is to make your own custom alert views to match your apps look and feel

prajeet 6 Nov 10, 2017
Check your Valorant store from your phone!

Valorant Store Checker Description VSC (Valorant Store Tracker) is an open source iOS app that allows you to track your store and preview your skins.

Gordon 20 Dec 29, 2022