Skip to content

Commit

Permalink
Merge pull request #12 from immobiliare/1.2.0
Browse files Browse the repository at this point in the history
Release 1.2.0
  • Loading branch information
malcommac committed Jan 22, 2022
2 parents 4e37fa6 + 3046842 commit 926ec44
Show file tree
Hide file tree
Showing 18 changed files with 275 additions and 74 deletions.
54 changes: 19 additions & 35 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,22 @@
name: Test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
name: "RealFlags CI"
on: [push, pull_request]

concurrency:
group: ci
cancel-in-progress: true

jobs:
Build:
runs-on: macos-latest
steps:
- uses: actions/cache@v2
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- uses: actions/checkout@v2
- name: Build & Run Tests
run: xcodebuild -scheme RealFlags-Package test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 12'

SwiftLint:
runs-on: ubuntu-latest
iOS:
name: Unit Tests (iOS 15.0, Xcode 13.0)
runs-on: macOS-11
env:
DEVELOPER_DIR: /Applications/Xcode_13.0.app/Contents/Developer
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
xcode_version: ["13.2.1"]
steps:
- name: Get file changes
id: get_file_changes
uses: trilom/file-changes-action@v1.2.3
with:
output: ' '
- name: Echo file changes
run: |
echo Changed files: ${{ steps.get_file_changes.outputs.files }}
- uses: actions/checkout@v1
- name: GitHub Action for SwiftLint (Only files changed in the PR)
uses: norio-nomura/action-swiftlint@3.1.0
env:
changedFiles: ${{ steps.get_file_changes.outputs.files }}
- uses: actions/checkout@v2
- name: Build & Run Tests
run: xcodebuild -scheme RealFlags-Package test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 12 Pro'
5 changes: 3 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import PackageDescription
let package = Package(
name: "RealFlags",
platforms: [
.iOS(.v13)
.iOS(.v13),
.macOS(.v10_12)
],
products: [
.library(name: "RealFlags", targets: ["RealFlags"]),
Expand All @@ -16,7 +17,7 @@ let package = Package(
.package(
name: "Firebase",
url: "https://github.com/firebase/firebase-ios-sdk.git",
from: "7.0.0"
from: "8.10.0"
)
],
targets: [
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ let fbProvider = FirebaseRemoteProvider()

// Loader is the point for query values
let userFlagsLoader = FlagsLoader(UserFlags.self, // load flags definition
description: .init(name: "User Features", description: "Cool experimental features for user account"),
providers: [fbProvider, localProvider]) // set providers
```

Expand All @@ -98,7 +99,9 @@ RealFlags also comes with an handy tool you can use to browse and edit feature f

[Checkout the doc for more infos!](./documentation/advanced_usage.md#3.5)

![](./documentation/assets/flags_browser_intro.gif)

https://user-images.githubusercontent.com/235645/150638946-99646e96-d155-451f-a723-585ad7978c43.mp4


## Tests

Expand Down
2 changes: 1 addition & 1 deletion RealFlags.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "RealFlags"
s.version = "1.1.3"
s.version = "1.2.0"
s.summary = "Feature flagging framework for Swift"
s.homepage = "https://github.com/immobiliare/RealFlags.git"
s.license = { :type => "MIT", :file => "LICENSE" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class FlagsBrowserDefaultCell: UITableViewCell, Reusable, NibType {

@IBOutlet public var subtitleLabel: UILabel!
@IBOutlet public var titlelabel: UILabel!
@IBOutlet public var valueLabel: UILabel!
@IBOutlet public var valueLabel: UILabel?
@IBOutlet public var iconView: UIImageView!
@IBOutlet public var iconContainerView: UIView!
@IBOutlet public var stackView: UIStackView!
Expand All @@ -27,7 +27,7 @@ public class FlagsBrowserDefaultCell: UITableViewCell, Reusable, NibType {
public var isDisabled: Bool = false {
didSet {
titlelabel.textColor = (isDisabled ? .lightGray : .black)
valueLabel.textColor = (isDisabled ? .red : .tintColor)
valueLabel?.textColor = (isDisabled ? .red : .tintColor)
subtitleLabel.textColor = (isDisabled ? .lightGray : .darkGray)
}
}
Expand All @@ -44,11 +44,11 @@ public class FlagsBrowserDefaultCell: UITableViewCell, Reusable, NibType {

titlelabel.text = title
subtitleLabel.text = subtitle
valueLabel.text = value
valueLabel?.text = value

titlelabel.isHidden = title?.isEmpty ?? true
subtitleLabel.isHidden = subtitle?.isEmpty ?? true
valueLabel.isHidden = value?.isEmpty ?? true
valueLabel?.isHidden = value?.isEmpty ?? true
}

public override func prepareForReuse() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -13,14 +13,14 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="87"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="MbZ-1g-8Rz" id="DPr-rx-ZhZ">
<rect key="frame" x="0.0" y="0.0" width="384.5" height="87"/>
<rect key="frame" x="0.0" y="0.0" width="385.5" height="87"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="Vsa-7k-Hfg">
<rect key="frame" x="15" y="5" width="359.5" height="77"/>
<rect key="frame" x="15" y="10" width="355.5" height="67"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nYb-UQ-bMw">
<rect key="frame" x="0.0" y="0.0" width="25" height="77"/>
<rect key="frame" x="0.0" y="0.0" width="25" height="67"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="htP-Da-Hdn">
<rect key="frame" x="0.0" y="5" width="25" height="25"/>
Expand All @@ -38,24 +38,24 @@
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="VHU-Lf-SzP">
<rect key="frame" x="35" y="0.0" width="188.5" height="77"/>
<rect key="frame" x="35" y="0.0" width="186" height="67"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" text="Title of the cell" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="W3Y-sW-Z9m">
<rect key="frame" x="0.0" y="0.0" width="188.5" height="18"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="252" verticalCompressionResistancePriority="751" text="Title of the cell" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="W3Y-sW-Z9m">
<rect key="frame" x="0.0" y="0.0" width="186" height="18"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Subtitle of the cell" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WDc-XH-fYD">
<rect key="frame" x="0.0" y="18" width="188.5" height="59"/>
<rect key="frame" x="0.0" y="18" width="186" height="49"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="249" verticalHuggingPriority="251" text="Value" textAlignment="right" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="80q-8J-lRx">
<rect key="frame" x="233.5" y="0.0" width="126" height="77"/>
<rect key="frame" x="231" y="0.0" width="124.5" height="67"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
Expand All @@ -68,10 +68,10 @@
</stackView>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="Vsa-7k-Hfg" secondAttribute="bottom" constant="5" id="N9a-yF-p7e"/>
<constraint firstAttribute="trailing" secondItem="Vsa-7k-Hfg" secondAttribute="trailing" constant="10" id="Ond-Sv-Oz5"/>
<constraint firstAttribute="bottom" secondItem="Vsa-7k-Hfg" secondAttribute="bottom" constant="10" id="N9a-yF-p7e"/>
<constraint firstAttribute="trailing" secondItem="Vsa-7k-Hfg" secondAttribute="trailing" constant="15" id="Ond-Sv-Oz5"/>
<constraint firstItem="Vsa-7k-Hfg" firstAttribute="leading" secondItem="DPr-rx-ZhZ" secondAttribute="leading" constant="15" id="dXV-c6-tcZ"/>
<constraint firstItem="Vsa-7k-Hfg" firstAttribute="top" secondItem="DPr-rx-ZhZ" secondAttribute="top" constant="5" id="rop-iE-4Jj"/>
<constraint firstItem="Vsa-7k-Hfg" firstAttribute="top" secondItem="DPr-rx-ZhZ" secondAttribute="top" constant="10" id="rop-iE-4Jj"/>
</constraints>
</tableViewCellContentView>
<connections>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// RealFlags
// Easily manage Feature Flags in Swift
//
// Created by the Mobile Team @ ImmobiliareLabs
// Email: mobile@immobiliare.it
// Web: http://labs.immobiliare.it
//
// Copyright ©2021 Immobiliare.it SpA. All rights reserved.
// Licensed under MIT License.
//

import UIKit

public class FlagsBrowserToggleCell: FlagsBrowserDefaultCell { //, Reusable, NibType {

// MARK: - IBOutlets

@IBOutlet public var switchButton: UISwitch!

// MARK: - Public Properties

/// Callback to listen and react to event. If return `false` the previous value will be restored.
public var onChangeSwitchValue: ((Bool) -> Bool)?

// MARK: - IBAction

@IBAction public func didChangeSwitchValue(_ sender: UISwitch) {
if onChangeSwitchValue?(switchButton.isOn) == false {
switchButton.isOn = !switchButton.isOn // restore previous value
}
}

}
Loading

0 comments on commit 926ec44

Please sign in to comment.