iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
niselover
V2EX  ›  iDev

Swift 如何监听模型所有属性的变化?..

  •  
  •   niselover · Sep 28, 2018 · 4930 views
    This topic created in 2785 days ago, the information mentioned may be changed or developed.
    想要用 extention 给 model 所有属性的 set 方面加一个监听
    但是好像没法实现 有大佬帮帮忙吗
    5 replies    2019-02-28 12:31:33 +08:00
    AriSwift
        1
    AriSwift  
       Sep 28, 2018
    不是很友好,可以考虑继承 NSObject 用 KVO 了
    kljsandjb
        2
    kljsandjb  
       Sep 28, 2018 via iPhone
    KVO 吧,专门干这事儿的
    jessehao7
        3
    jessehao7  
       Oct 10, 2018
    如果这个模型是结构体,一个 didSet 搞定
    vincentxbb
        4
    vincentxbb  
       Oct 10, 2018
    KVO 又或者用 Rx 系列吧,都能一直监听
    zenghaojim33
        5
    zenghaojim33  
       Feb 28, 2019
    RxSwift
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   905 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 916ms · UTC 20:58 · PVG 04:58 · LAX 13:58 · JFK 16:58
    ♥ Do have faith in what you're doing.