Skip to content

Commit

Permalink
Merge branch 'dkk-bugfix/162_wrong-color-on-light-mode-switch'
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenyneu committed May 23, 2020
2 parents 613bccf + bd2e613 commit c1f8763
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Cosmos version history


## 22.0.0 (2020-05-23)

* Allow switching between light/dark modes without restarting (https://github.com/evgenyneu/Cosmos/issues/162).


## 21.0.0 (2020-01-20)

* Set `APPLICATION_EXTENSION_API_ONLY` to `Yes` (https://github.com/evgenyneu/Cosmos/pull/155).
Expand Down
2 changes: 1 addition & 1 deletion Cosmos.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Cosmos"
s.version = "21.0.0"
s.version = "22.0.0"
s.license = { :type => "MIT" }
s.homepage = "https://github.com/evgenyneu/Cosmos"
s.summary = "5-star rating control written in Swift"
Expand Down
16 changes: 16 additions & 0 deletions Cosmos/CosmosView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,22 @@ Shows: ★★★★☆ (123)
previousRatingForDidTouchCallback = -123.192
}

/**

Makes sure that the right colors are used when the user switches between Light and Dark mode
while the app is running

*/
open override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)

if #available(iOS 13.0, *) {
if self.traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle {
update()
}
}
}

// MARK: - Accessibility

private func updateAccessibility() {
Expand Down
16 changes: 16 additions & 0 deletions Distrib/CosmosDistrib.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,22 @@ Shows: ★★★★☆ (123)
previousRatingForDidTouchCallback = -123.192
}

/**

Makes sure that the right colors are used when the user switches between Light and Dark mode
while the app is running

*/
open override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)

if #available(iOS 13.0, *) {
if self.traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle {
update()
}
}
}

// MARK: - Accessibility

private func updateAccessibility() {
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ Simply add [CosmosDistrib.swift](https://github.com/evgenyneu/Cosmos/blob/master

#### Setup with Carthage (iOS 8+)

Alternatively, add `github "evgenyneu/Cosmos" ~> 21.0` to your Cartfile and run `carthage update`.
Alternatively, add `github "evgenyneu/Cosmos" ~> 22.0` to your Cartfile and run `carthage update`.

#### Setup with CocoaPods (iOS 8+)

If you are using CocoaPods add this text to your Podfile and run `pod install`.

use_frameworks!
target 'Your target name'
pod 'Cosmos', '~> 21.0'
pod 'Cosmos', '~> 22.0'


#### Setup with Swift Package Manager
Expand Down Expand Up @@ -232,6 +232,7 @@ We would like to thank the following people for their valuable contributions.
* [yuravake](https://github.com/yuravake) for adding `passTouchesToSuperview` setting.
* [gcharita](https://github.com/gcharita) for adding Swift Package Manager support.
* [benpackard](https://github.com/benpackard) for fixing Cosmos when used in a modal screen on iOS 13.
* [dkk](https://github.com/dkk) for the dark mode update.



Expand Down

0 comments on commit c1f8763

Please sign in to comment.