Skip to content

Commit

Permalink
Release 0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rwbutler committed Oct 30, 2018
1 parent ad765ad commit ebc9981
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 27 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.0.3] - 2018-10-30
### Added
- FeatureFlagsViewControllerDelegate allows caller to be informed when view controller work is complete.
### Changed
- Fixes for FeatureFlagsViewController row animations.

## [0.0.2] - 2018-10-25
### Changed
- Making scheme shared to support Carthage.

## [0.0.1] - 2018-10-25
### Added
- Initial release.
2 changes: 2 additions & 0 deletions Example/FeatureFlags/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class ViewController: UIViewController {
print("Is in group B? -> \(test.isGroupB())")
}

print(Feature.isEnabled(.exampleABTest))

}

}
Expand Down
8 changes: 8 additions & 0 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion FeatureFlags.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'FeatureFlags'
s.version = '0.0.1'
s.version = '0.0.3'
s.swift_version = '4.2'
s.summary = 'Feature flags, A/B and MVT testing for iOS'
s.description = <<-DESC
Expand Down
9 changes: 8 additions & 1 deletion FeatureFlags/Classes/Core/FeatureFlags.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,19 @@ public struct FeatureFlags {
public static func pushFeatureFlags(navigationController: UINavigationController, animated: Bool = false) {
let featureFlagsViewController = FeatureFlagsViewController(style: .grouped)
let navigationSettings = FeatureFlagsViewController
.NavigationSettings(animated: animated, isNavigationBarHidden: navigationController.isNavigationBarHidden)
.NavigationSettings(animated: animated, autoClose: true, isNavigationBarHidden: navigationController.isNavigationBarHidden)
featureFlagsViewController.navigationSettings = navigationSettings
navigationController.isNavigationBarHidden = false
navigationController.pushViewController(featureFlagsViewController, animated: animated)
}

public static func pushFeatureFlags(navigationController: UINavigationController, navigationSettings: FeatureFlagsViewControllerNavigationSettings) {
let featureFlagsViewController = FeatureFlagsViewController(style: .grouped)
featureFlagsViewController.navigationSettings = navigationSettings
navigationController.isNavigationBarHidden = false
navigationController.pushViewController(featureFlagsViewController, animated: navigationSettings.animated)
}

public static func refresh(_ completion:(()-> Void)? = nil) {
configuration = loadConfiguration(completion)
}
Expand Down
2 changes: 1 addition & 1 deletion FeatureFlags/Classes/Model/Feature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public struct Feature {
fatalError("A feature must always be categorizable into a test variation.")
}

public static func isEnabled(feature featureName: Feature.Name) -> Bool {
public static func isEnabled(_ featureName: Feature.Name) -> Bool {
guard let feature = named(featureName) else { return false }
return feature.isEnabled()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ import UIKit
class FeatureFlagsViewController: UITableViewController {

// MARK: Type definitions
public struct NavigationSettings {
let animated: Bool
let isNavigationBarHidden: Bool
}
public typealias Delegate = FeatureFlagsViewControllerDelegate
public typealias NavigationSettings = FeatureFlagsViewControllerNavigationSettings

// MARK: State
var delegate: Delegate?
var navigationSettings: NavigationSettings?

override func viewDidLoad() {
Expand Down Expand Up @@ -60,16 +59,17 @@ class FeatureFlagsViewController: UITableViewController {

switch feature.type {
case .featureFlag, .featureTest(.featureFlagAB):
UIView.animate(withDuration: 1.0, animations: {
allLabels.forEach({ label in
label?.textColor = UIColor.white
})
cell.contentView.backgroundColor = feature.isEnabled()
? UIColor(red: 63.0/255.0, green: 134.0/255.0, blue: 80.0/255.0, alpha: 1.0)
: UIColor(red: 189.0/255.0, green: 50.0/255.0, blue: 80.0/255.0, alpha: 1.0)
allLabels.forEach({ label in
label?.textColor = UIColor.white
})
cell.contentView.backgroundColor = feature.isEnabled()
? UIColor(red: 63.0/255.0, green: 134.0/255.0, blue: 80.0/255.0, alpha: 1.0)
: UIColor(red: 189.0/255.0, green: 50.0/255.0, blue: 80.0/255.0, alpha: 1.0)
case .featureTest(.ab), .featureTest(.mvt), .deprecated:
break
allLabels.forEach({ label in
label?.textColor = UIColor.black
})
cell.contentView.backgroundColor = UIColor.white
}
featureFlagCell.featureEnabled.isHidden = true // Always hide for now
return featureFlagCell
Expand Down Expand Up @@ -105,11 +105,11 @@ extension FeatureFlagsViewController {
case .featureTest(.ab):
if let alternateABVariant = feature.testVariations.filter({ $0 != feature.testVariation() }).first {
FeatureFlags.updateFeatureTestVariation(feature: feature.name, testVariation: alternateABVariant)
tableView.reloadData()
tableView.reloadRows(at: [indexPath], with: .fade)
}
case .featureFlag, .featureTest(.featureFlagAB):
FeatureFlags.updateFeatureIsEnabled(feature: feature.name, isEnabled: !feature.isEnabled())
tableView.reloadData()
tableView.reloadRows(at: [indexPath], with: .fade)
case .featureTest(.mvt):
presentPickerViewController(on: self, with: feature)
case .deprecated:
Expand Down Expand Up @@ -159,12 +159,15 @@ private extension FeatureFlagsViewController {
}

@objc func close() {
if let navigationController = navigationController, let settings = navigationSettings {
navigationController.isNavigationBarHidden = settings.isNavigationBarHidden
navigationController.popViewController(animated: settings.animated)
} else {
dismiss(animated: true, completion: nil)
if navigationSettings?.autoClose ?? true {
if let navigationController = navigationController, let settings = navigationSettings {
navigationController.isNavigationBarHidden = settings.isNavigationBarHidden
navigationController.popViewController(animated: settings.animated)
} else {
dismiss(animated: navigationSettings?.animated ?? false, completion: nil)
}
}
delegate?.viewControllerDidFinish()
}

/// Retrieves the current bundle
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// FeatureFlagsViewControllerDelegate.swift
// FeatureFlags
//
// Created by Ross Butler on 10/30/18.
//

import Foundation

@objc public protocol FeatureFlagsViewControllerDelegate: class {
@objc func viewControllerDidFinish()
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// NavigationSettings.swift
// FeatureFlags
//
// Created by Ross Butler on 10/30/18.
//

import Foundation

@objc public class FeatureFlagsViewControllerNavigationSettings: NSObject {
let animated: Bool
let autoClose: Bool
let isNavigationBarHidden: Bool

init(animated: Bool, autoClose: Bool, isNavigationBarHidden: Bool) {
self.animated = animated
self.autoClose = autoClose
self.isNavigationBarHidden = isNavigationBarHidden
}
}
31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# FeatureFlags
#![FeatureFlags](https://github.com/rwbutler/FeatureFlags/raw/master/FeatureFlags.png)

[![CI Status](https://img.shields.io/travis/rwbutler/FeatureFlags.svg?style=flat)](https://travis-ci.org/rwbutler/FeatureFlags)
[![Version](https://img.shields.io/cocoapods/v/FeatureFlags.svg?style=flat)](https://cocoapods.org/pods/FeatureFlags)
[![License](https://img.shields.io/cocoapods/l/FeatureFlags.svg?style=flat)](https://cocoapods.org/pods/FeatureFlags)
[![Platform](https://img.shields.io/cocoapods/p/FeatureFlags.svg?style=flat)](https://cocoapods.org/pods/FeatureFlags)
[![CI Status](http://img.shields.io/travis/rwbutler/FeatureFlags.svg?style=flat)](https://travis-ci.org/rwbutler/FeatureFlags)
[![Version](https://img.shields.io/cocoapods/v/FeatureFlags.svg?style=flat)](http://cocoapods.org/pods/Featureflags)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![License](https://img.shields.io/cocoapods/l/FeatureFlags.svg?style=flat)](http://cocoapods.org/pods/FeatureFlags)
[![Platform](https://img.shields.io/cocoapods/p/FeatureFlags.svg?style=flat)](http://cocoapods.org/pods/FeatureFlags)

## Example

Expand All @@ -27,3 +28,23 @@ Ross Butler
## License

FeatureFlags is available under the MIT license. See the LICENSE file for more info.

## Additional Software

### Frameworks

* [Connectivity](https://github.com/rwbutler/Connectivity) - Improves on Reachability for determining Internet connectivity in your iOS application.
* [FeatureFlags](https://github.com/rwbutler/FeatureFlags) - Allows developers to configure feature flags, run multiple A/B or MVT tests using a bundled / remotely-hosted JSON configuration file.
* [Skylark](https://github.com/rwbutler/Skylark) - Fully Swift BDD testing framework for writing Cucumber scenarios using Gherkin syntax.
* [TailorSwift](https://github.com/rwbutler/TailorSwift) - A collection of useful Swift Core Library / Foundation framework extensions.
* [TypographyKit](https://github.com/rwbutler/TypographyKit) - Consistent & accessible visual styling on iOS with Dynamic Type support.

### Tools
* [Palette](https://github.com/rwbutler/TypographyKitPalette) - Makes your [TypographyKit](https://github.com/rwbutler/TypographyKit) color palette available in Xcode Interface Builder.


[Connectivity](https://github.com/rwbutler/Connectivity) | [Skylark](https://github.com/rwbutler/Skylark) | [TypographyKit](https://github.com/rwbutler/TypographyKit) | [Palette](https://github.com/rwbutler/TypographyKitPalette)
:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:
[![Connectivity](https://github.com/rwbutler/Connectivity/raw/master/ConnectivityLogo.png)](https://github.com/rwbutler/Connectivity) | [![Skylark](https://github.com/rwbutler/Skylark/raw/master/SkylarkLogo.png)](https://github.com/rwbutler/Skylark) | [![TypographyKit](https://github.com/rwbutler/TypographyKit/raw/master/TypographyKitLogo.png)](https://github.com/rwbutler/TypographyKit) | [![Palette](https://github.com/rwbutler/TypographyKitPalette/raw/master/PaletteLogo.png)](https://github.com/rwbutler/TypographyKitPalette)


0 comments on commit ebc9981

Please sign in to comment.