M13Checkbox+IB.swift 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //
  2. // M13Checkbox+IB.swift
  3. // M13Checkbox
  4. //
  5. // Created by McQuilkin, Brandon on 2/24/16.
  6. // Copyright © 2016 Brandon McQuilkin. All rights reserved.
  7. //
  8. // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
  9. //
  10. // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  11. //
  12. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  13. import UIKit
  14. public extension M13Checkbox {
  15. /// A proxy to set the box type compatible with interface builder.
  16. @IBInspectable var _IBStateChangeAnimation: String {
  17. get {
  18. return stateChangeAnimation.rawValue
  19. }
  20. set {
  21. if let type = Animation(rawValue: newValue) {
  22. stateChangeAnimation = type
  23. } else {
  24. stateChangeAnimation = DefaultValues.animation
  25. }
  26. }
  27. }
  28. /// A proxy to set the mark type compatible with interface builder.
  29. @IBInspectable var _IBMarkType: String {
  30. get {
  31. return markType.rawValue
  32. }
  33. set {
  34. if let type = MarkType(rawValue: newValue) {
  35. markType = type
  36. } else {
  37. markType = DefaultValues.markType
  38. }
  39. }
  40. }
  41. /// A proxy to set the box type compatible with interface builder.
  42. @IBInspectable var _IBBoxType: String {
  43. get {
  44. return boxType.rawValue
  45. }
  46. set {
  47. if let type = BoxType(rawValue: newValue) {
  48. boxType = type
  49. } else {
  50. boxType = DefaultValues.boxType
  51. }
  52. }
  53. }
  54. /// A proxy to set the check state compatible with interface builder.
  55. @IBInspectable var _IBCheckState: String {
  56. get {
  57. return checkState.rawValue
  58. }
  59. set {
  60. if let temp = CheckState(rawValue: newValue) {
  61. checkState = temp
  62. } else {
  63. checkState = DefaultValues.checkState
  64. }
  65. }
  66. }
  67. }