mirror of
https://github.com/SoPat712/YTLitePlus.git
synced 2025-10-30 12:23:58 -04:00
added files via upload
This commit is contained in:
42
Tweaks/Alderis/info/Migrating to 1.1.md
Normal file
42
Tweaks/Alderis/info/Migrating to 1.1.md
Normal file
@@ -0,0 +1,42 @@
|
||||
## Migrating to 1.1
|
||||
|
||||
### ColorPickerConfiguration
|
||||
A variety of configuration options have been added, configured on a new `ColorPickerConfiguration` class.
|
||||
|
||||
Code that looks like this:
|
||||
|
||||
```swift
|
||||
let colorPicker = ColorPickerViewController()
|
||||
colorPicker.color = UIColor(red: 1, green: 0, blue: 1, alpha: 0)
|
||||
present(colorPicker, animated: true, completion: nil)
|
||||
```
|
||||
|
||||
Should now become:
|
||||
|
||||
```swift
|
||||
let configuration = ColorPickerConfiguration(color: UIColor(red: 1, green: 0, blue: 1, alpha: 0))
|
||||
// Do any other configuration you want here…
|
||||
let colorPicker = ColorPickerViewController(configuration: configuration)
|
||||
present(colorPicker, animated: true, completion: nil)
|
||||
```
|
||||
|
||||
### Delegate changes
|
||||
`ColorPickerDelegate.colorPicker(_:didSelect:)` is now fired with every change made within the color picker interface. Ensure any work done in this method does not assume the value is the user’s final selection. You might use this to update your user interface based on the current selection. If there is nothing useful you can do to improve the user experience, don’t implement this method.
|
||||
|
||||
The new `ColorPickerDelegate.colorPicker(_:didAccept:)` method is now used to signal the user dismissing the color picker with a positive response, by tapping the Done button or dismissing the popover.
|
||||
|
||||
For compatibility, if the color is set via the deprecated `ColorPickerViewController.color` API, the delegate behaves as it did in Alderis 1.0.
|
||||
|
||||
### Popover style
|
||||
Alderis now uses popovers, providing a more integrated interface design on iPad and Mac Catalyst. In order to support this, some popover presentation parameters must be set. If they are not set, UIKit throws an exception on presenting the view controller.
|
||||
|
||||
For example:
|
||||
|
||||
```swift
|
||||
@IBAction func presentColorPicker(_ sender: UIView) {
|
||||
let configuration = ColorPickerConfiguration(color: UIColor(red: 1, green: 0, blue: 1, alpha: 0))
|
||||
let colorPicker = ColorPickerViewController(configuration: configuration)
|
||||
colorPicker.popoverPresentationController?.sourceView = sender
|
||||
present(colorPicker, animated: true, completion: nil)
|
||||
}
|
||||
```
|
||||
33
Tweaks/Alderis/info/Preference Bundles.md
Normal file
33
Tweaks/Alderis/info/Preference Bundles.md
Normal file
@@ -0,0 +1,33 @@
|
||||
## Alderis with Preference Bundles
|
||||
Alderis acts as a drop-in replacement for [libcolorpicker](https://github.com/atomikpanda/libcolorpicker), an abandoned but still very popular color picker library on jailbroken iOS. Packages can simply change their dependencies list to replace `org.thebigboss.libcolorpicker` with `ws.hbang.alderis (>= 1.1)` to switch the color picker to Alderis. No other changes required!
|
||||
|
||||
Alderis also provides a replacement, cleaner interface for preference bundles. Example usage:
|
||||
|
||||
```xml
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSLinkCell</string>
|
||||
<key>cellClass</key>
|
||||
<string>HBColorPickerTableCell</string>
|
||||
<key>defaults</key>
|
||||
<string>com.example.myawesomething</string>
|
||||
<key>default</key>
|
||||
<string>#33b5e5</string>
|
||||
<key>label</key>
|
||||
<string>Tint Color</string>
|
||||
<key>showAlphaSlider</key>
|
||||
<true/>
|
||||
<key>PostNotification</key>
|
||||
<string>com.example.myawesomething/ReloadPrefs</string>
|
||||
</dict>
|
||||
```
|
||||
|
||||
Compared to libcolorpicker’s API design, this leans on the fundamentals of Preferences.framework, including using the framework’s built-in preference value getters/setters system. In fact, the only two distinct parts are the `cellClass` and the `showAlphaSlider` key. The rest should seem natural to typical Preference specifier plist usage.
|
||||
|
||||
Remember to link against the `libcolorpicker` library from the preference bundle. With Theos, this might look like:
|
||||
|
||||
```make
|
||||
MyAwesomeThing_LIBRARIES = colorpicker
|
||||
```
|
||||
|
||||
The functionality described in this section is only available in the jailbreak package for Alderis, specifically in the `libcolorpicker.dylib` binary ([lcpshim](https://github.com/hbang/Alderis/tree/main/lcpshim)), and is not included in the App Store (CocoaPods/Carthage) version.
|
||||
Reference in New Issue
Block a user