수색…


소개

MessageBox는 디커플링 엔티티에 대한 간단한 개념입니다.

예를 들어 엔티티 A는 엔티티 B가 적합 할 때마다 읽을 수있는 메시지를 배치 할 수 있습니다.

보기 컨트롤러가 다른보기 컨트롤러와 대화하고 싶지만 강하고 약한 관계를 만들고 싶지는 않습니다.

간단한 예제 사용법

여기에 이미지 설명을 입력하십시오.

let messageBox:MessageBox = MessageBox()

// set
messageBox.setObject("TestObject1", forKey:"TestKey1")

// get
// but don't remove it, keep it stored, so that it can still be retrieved later
let someObject:String = messageBox.getObject(forKey:"TestKey1", removeIfFound:false)

// get
// and remove it
let someObject:String = messageBox.getObject(forKey:"TestKey1", removeIfFound:true)


Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow