Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add iOS 11 support #24

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import PackageDescription
let package = Package(
name: "RealFlags",
platforms: [
.iOS(.v13)
.iOS(.v11),
],
products: [
.library(name: "RealFlags", targets: ["RealFlags"]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public class FlagsBrowserController: UIViewController {
case let collection as AnyFlagCollection:
return FlagBrowserItem(title: collection.name,
subtitle: collection.description,
icon: UIImage(named: "datatype_list", in: .libraryBundle, with: nil),
icon: UIImage(named: "datatype_list", in: .libraryBundle, compatibleWith: nil),
accessoryType: .disclosureIndicator,
selectable: true,
representedObj: collection)
Expand Down Expand Up @@ -484,19 +484,19 @@ extension AnyFlag {
// Default data type icons
switch dataType {
case is String.Type:
return UIImage(named: "datatype_string", in: .libraryBundle, with: .none)
return UIImage(named: "datatype_string", in: .libraryBundle, compatibleWith: nil)

case is Bool.Type:
return UIImage(named: "datatype_bool", in: .libraryBundle, with: .none)
return UIImage(named: "datatype_bool", in: .libraryBundle, compatibleWith: nil)

case is Int.Type, is Int8.Type, is Int16.Type, is Int32.Type, is Int64.Type:
return UIImage(named: "datatype_number", in: .libraryBundle, with: .none)
return UIImage(named: "datatype_number", in: .libraryBundle, compatibleWith: nil)

case is Double.Type:
return UIImage(named: "datatype_number", in: .libraryBundle, with: .none)
return UIImage(named: "datatype_number", in: .libraryBundle, compatibleWith: nil)

case is JSONData.Type:
return UIImage(named: "datatype_json", in: .libraryBundle, with: .none)
return UIImage(named: "datatype_json", in: .libraryBundle, compatibleWith: nil)

default:
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Licensed under MIT License.
//

#if !os(Linux)
#if canImport(Combine)
import Combine
#endif

Expand Down Expand Up @@ -47,13 +47,14 @@ public protocol FlagsProvider {
/// Reset the value for keypath; it will remove the value from the record of the flag provider.
func resetValueForFlag(key: FlagKeyPath) throws

#if !os(Linux)
#if canImport(Combine)
// Apple platform also support Combine framework to provide realtime notification of new events to any subscriber.
// By default it does nothing (take a look to the default implementation in extension below).

/// You can use this value to receive updates when keys did updated in sources.
///
/// - Parameter keys: updated keys; may be `nil` if your provider does not support this kind of granularity.
@available(iOS 13.0, macOS 10.15, *)
func didUpdateValuesForKeys(_ keys: Set<String>?) -> AnyPublisher<Set<String>, Never>?

#endif
Expand All @@ -62,12 +63,12 @@ public protocol FlagsProvider {

// MARK: - FlagsProvider (Default Publisher Behaviour)

#if !os(Linux)
#if canImport(Combine)

/// Make support for real-time flag updates optional by providing a default nil implementation
///
public extension FlagsProvider {

@available(iOS 13.0, macOS 10.15, *)
func didUpdateValuesForKeys(_ keys: Set<String>?) -> AnyPublisher<Set<String>, Never>? {
nil
}
Expand Down