-2
import UIKit
import Foundation

open class podview: UIView {
    open var strk = UIColor.black
    .
    .
}

I have to change the value of "strk" from another view controller. Is it possible to do it.

Kuldeep
  • 4,466
  • 8
  • 32
  • 59
Faheem Rahman
  • 343
  • 2
  • 10

2 Answers2

1

I'm just providing you trick.

Yes you can change it. First you need to import model of the pod. then you need to create object of the podview and then you will be able to access strk like

objectOfPodView.strk
Govaadiyo
  • 5,644
  • 9
  • 43
  • 72
1

YES, You can do it. There are two way to do this.

  1. Local Notification (NSNotification)

NSNotificationCenter addObserver in Swift

  1. Delegatation

Examples of Delegates in Swift

  1. If you want to Change View controller B Value from View controller A then you can directly access to it.

For EX ViewcontrollerB.yourVariable = Assign value - From View Controller A

Please review and understand both concepts.

Happy Coding..:)

Renish Dadhaniya
  • 10,642
  • 2
  • 31
  • 56