diff --git a/.circleci/config.yml b/.circleci/config.yml index d7c8e90..04688e3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,8 +1,8 @@ version: 2.1 orbs: - # This uses the iOS Orb located at https://github.com/wordpress-mobile/circleci-orbs - ios: wordpress-mobile/ios@0.0.25 + # Using 1.0 of our Orbs means it will use the latest 1.0.x version from https://github.com/wordpress-mobile/circleci-orbs + ios: wordpress-mobile/ios@1.0 workflows: test_and_validate: @@ -29,3 +29,15 @@ workflows: name: Validate Podspec xcode-version: "10.2.0" podspec-path: WordPressUI.podspec + bundle-install: true + - ios/publish-podspec: + name: Publish to Trunk + xcode-version: "10.2.0" + podspec-path: WordPressUI.podspec + bundle-install: true + post-to-slack: true + filters: + tags: + only: /.*/ + branches: + ignore: /.*/ diff --git a/Example/Example/Base.lproj/Main.storyboard b/Example/Example/Base.lproj/Main.storyboard index c4fa09a..6b74573 100644 --- a/Example/Example/Base.lproj/Main.storyboard +++ b/Example/Example/Base.lproj/Main.storyboard @@ -1,10 +1,10 @@ - - - - + + - + + + @@ -18,7 +18,7 @@ - + @@ -32,17 +32,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/Example/Example/ViewController.swift b/Example/Example/ViewController.swift index 4523102..eaf181b 100644 --- a/Example/Example/ViewController.swift +++ b/Example/Example/ViewController.swift @@ -28,7 +28,11 @@ class ViewController: UITableViewController self.showFancyAlertWithSwitch() })] ), - DemoSection(title: "Misc UI Elements", rows: []), + DemoSection(title: "Misc UI Elements", rows: [ + DemoRow(title: "Fancy Buttons", action: { + self.showFancyButtons() + }) + ]), ] } @@ -101,6 +105,12 @@ class ViewController: UITableViewController showFancyAlert(switchConfig: switchConfig) } + + // MARK: - Fancy Buttons + + func showFancyButtons() { + performSegue(withIdentifier: "FancyButtonsSegue", sender: self) + } // MARK: - Test Messages for the User @@ -184,3 +194,5 @@ struct DemoRow { var title: String var action: RowAction } + +class FancyButtonsViewController: UIViewController {} diff --git a/Gemfile b/Gemfile index fd43c04..09c4d6e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,3 @@ source 'https://rubygems.org' do - gem 'cocoapods', '1.6.1' + gem 'cocoapods', '~> 1.8.0' end diff --git a/Gemfile.lock b/Gemfile.lock index 229da14..bcfcc7b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,35 +1,40 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.0) + CFPropertyList (3.0.1) activesupport (4.2.11.1) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + algoliasearch (1.27.1) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) atomos (0.1.3) - claide (1.0.2) - cocoapods (1.6.1) + claide (1.0.3) + cocoapods (1.8.4) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.6.1) - cocoapods-deintegrate (>= 1.0.2, < 2.0) + cocoapods-core (= 1.8.4) + cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-stats (>= 1.0.0, < 2.0) - cocoapods-trunk (>= 1.3.1, < 2.0) + cocoapods-trunk (>= 1.4.0, < 2.0) cocoapods-try (>= 1.1.0, < 2.0) colored2 (~> 3.1) escape (~> 0.0.4) - fourflusher (>= 2.2.0, < 3.0) + fourflusher (>= 2.3.0, < 3.0) gh_inspector (~> 1.0) molinillo (~> 0.6.6) nap (~> 1.0) ruby-macho (~> 1.4) - xcodeproj (>= 1.8.1, < 2.0) - cocoapods-core (1.6.1) + xcodeproj (>= 1.11.1, < 2.0) + cocoapods-core (1.8.4) activesupport (>= 4.0.2, < 6) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) fuzzy_match (~> 2.0.4) nap (~> 1.0) cocoapods-deintegrate (1.0.4) @@ -38,19 +43,21 @@ GEM nap cocoapods-search (1.0.0) cocoapods-stats (1.1.0) - cocoapods-trunk (1.3.1) + cocoapods-trunk (1.4.1) nap (>= 0.8, < 2.0) netrc (~> 0.11) cocoapods-try (1.1.0) colored2 (3.1.2) concurrent-ruby (1.1.5) escape (0.0.4) - fourflusher (2.2.0) + fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) + httpclient (2.8.3) i18n (0.9.5) concurrent-ruby (~> 1.0) - minitest (5.11.3) + json (2.2.0) + minitest (5.12.2) molinillo (0.6.6) nanaimo (0.2.6) nap (1.1.0) @@ -59,7 +66,7 @@ GEM thread_safe (0.3.6) tzinfo (1.2.5) thread_safe (~> 0.1) - xcodeproj (1.9.0) + xcodeproj (1.13.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -70,7 +77,7 @@ PLATFORMS ruby DEPENDENCIES - cocoapods (= 1.6.1)! + cocoapods (~> 1.8.0)! BUNDLED WITH - 2.0.1 + 2.0.2 diff --git a/WordPressUI.podspec b/WordPressUI.podspec index 567cc5b..080643c 100644 --- a/WordPressUI.podspec +++ b/WordPressUI.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "WordPressUI" - s.version = "1.3.5" + s.version = "1.4" s.summary = "Home of reusable WordPress UI components." s.description = <<-DESC diff --git a/WordPressUI/Extensions/UIImage+Assets.swift b/WordPressUI/Extensions/UIImage+Assets.swift index 0177227..f166a55 100644 --- a/WordPressUI/Extensions/UIImage+Assets.swift +++ b/WordPressUI/Extensions/UIImage+Assets.swift @@ -33,15 +33,13 @@ extension UIImage { return Bundle.wordPressUIBundle } - /// Renders the Background Image with the specified Background + Size + Radius + Insets parameters. + /// Renders the Background Image with the specified Background + Size + Insets parameters. /// public class func renderBackgroundImage(fill: UIColor, - border: UIColor, + border: UIColor? = nil, size: CGSize = DefaultRenderMetrics.backgroundImageSize, cornerRadius: CGFloat = DefaultRenderMetrics.backgroundCornerRadius, - capInsets: UIEdgeInsets = DefaultRenderMetrics.backgroundCapInsets, - shadowOffset: CGSize = DefaultRenderMetrics.backgroundShadowOffset, - shadowBlurRadius: CGFloat = DefaultRenderMetrics.backgroundShadowBlurRadius) -> UIImage { + capInsets: UIEdgeInsets = DefaultRenderMetrics.backgroundCapInsets) -> UIImage { let renderer = UIGraphicsImageRenderer(size: size) let image = renderer.image { context in @@ -54,23 +52,24 @@ extension UIImage { var bounds = renderer.format.bounds bounds.origin.x += lineWidthInPixels bounds.origin.y += lineWidthInPixels - bounds.size.height -= lineWidthInPixels * 2 + shadowOffset.height - bounds.size.width -= lineWidthInPixels * 2 + shadowOffset.width + bounds.size.height -= lineWidthInPixels * 2 + bounds.size.width -= lineWidthInPixels * 2 let path = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius) /// Draw: Background + Shadow cgContext.saveGState() - cgContext.setShadow(offset: shadowOffset, blur: shadowBlurRadius, color: border.cgColor) + fill.setFill() path.fill() cgContext.restoreGState() - /// Draw: Border! - border.setStroke() - path.stroke() + if let border = border { + border.setStroke() + path.stroke() + } } return image.resizableImage(withCapInsets: capInsets) @@ -82,8 +81,6 @@ extension UIImage { public static let backgroundImageSize = CGSize(width: 44, height: 44) public static let backgroundCornerRadius = CGFloat(8) public static let backgroundCapInsets = UIEdgeInsets(top: 18, left: 18, bottom: 18, right: 18) - public static let backgroundShadowOffset = CGSize(width: 0, height: 2) - public static let backgroundShadowBlurRadius = CGFloat(0) public static let contentInsets = UIEdgeInsets(top: 12, left: 20, bottom: 12, right: 20) } } diff --git a/WordPressUI/FancyAlert/FancyButton.swift b/WordPressUI/FancyAlert/FancyButton.swift index effba60..2020663 100644 --- a/WordPressUI/FancyAlert/FancyButton.swift +++ b/WordPressUI/FancyAlert/FancyButton.swift @@ -13,7 +13,7 @@ open class FancyButton: UIButton { configureBackgrounds() } } - @objc public dynamic var primaryNormalBorderColor = Primary.normalBorderColor { + @objc public dynamic var primaryNormalBorderColor: UIColor? = nil { didSet { configureBackgrounds() } @@ -26,7 +26,7 @@ open class FancyButton: UIButton { configureBackgrounds() } } - @objc public dynamic var primaryHighlightBorderColor = Primary.highlightBorderColor { + @objc public dynamic var primaryHighlightBorderColor: UIColor? = nil { didSet { configureBackgrounds() } @@ -185,9 +185,7 @@ private extension FancyButton { /// struct Primary { static let normalBackgroundColor = UIColor(red: 0x00/255.0, green: 0xAA/255.0, blue: 0xDC/255.0, alpha: 0xFF/255.0) - static let normalBorderColor = UIColor(red: 0x00/255.0, green: 0x87/255.0, blue: 0xBE/255.0, alpha: 0xFF/255.0) static let highlightBackgroundColor = UIColor(red: 0x00/255.0, green: 0x87/255.0, blue: 0xBE/255.0, alpha: 0xFF/255.0) - static let highlightBorderColor = normalBorderColor } /// Style: Secondary