Changelog History
-
v0.1.2
November 01, 2018 -
v0.1.1
January 18, 2018 -
v0.1.0 Changes
January 13, 20180๏ธโฃ Ambience persists over app sessions using
UserDefaults
and also anchors itsAmbience Object
popover to the sender being it either aUIView
or aBar Button Item
-
v0.0.6 Changes
January 10, 20180๏ธโฃ Ambience persists using User Defaults and Text Field Placeholder is set to 50% alpha off current Ambience State text color.
-
v0.0.5 Changes
January 06, 2018Known issues
Text View inside Collection
If you are using a Text View inside a Table View Cell or a Collection View Cell and, in the process of dequeuing it you set its attributed text, beware. Right after assigning the new Attributed Text will need to write a mandatory single line of code to have Ambience work in the Text View properly.
Follow the example:
// Inside the respective Table View Controlleroverride func tableView(\_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -\> UITableViewCell { let cell : TextTableCell! = tableView.dequeueReusableCell(withIdentifier: "Cell with text") as! TextTableCell cell.textView?.reinstateAmbience() return cell }
-
v0.0.4
January 05, 2018 -
v0.0.3
January 04, 2018 -
v0.0.2 Changes
January 04, 2018๐ This release adds support for user control using forced states.
๐ป This is procured using a UI Alert View Controller associated to a Storyboard Scene or by simply instantiating a Ambience Object, setting it's view controller and asking it to present the Alert View Controller.
-
v0.0.1 Changes
January 03, 20180.0.1 Bare minimal
๐ Ambience has built-in support for the background color for the following Interface Builder objects:
- View and all its children;
- Search, Navigation and Tab bars and all of its children;
- Text View, Button, and Label and all of its children.
๐ There is also support for the text color for:
- Text View, Button, and Label and all of its children.
Custom Behaviors
It's also possible to define custom Ambience behavior on any Object that inherits from
NSObject
. Follow the instructions.Define an Override of the Ambience Method
๐ In this example, we are implementing the current behavior for Search, Navigation and Tab bars. It guards the notification data for the current state as an
Ambience State
and sets the bar style accordingly.public override func ambience(\_ notification : Notification) { super.ambience(notification) guard let currentState = notification.userInfo?["currentState"] as? AmbienceState else { return } barStyle = currentState == .invert ? .black : .default}
The notification user info dictionary also comes with the previous state so that more complex stateful behaviors can be implemented. It may also come with an
animated
boolean attribute the is usually set to true and, at the first run, set to false so as not to have animation upon view appearance.Turning Ambience On
๐ If your object is set on Interface Builder , use the Attributes Inspector and set to On the Ambience value.
In case you are setting this object programmatically, just set its
ambience
boolean value totrue
before placing it.