Visuality简化iOS UI处理
Visuality 是一个 iOS 库,简化了对 Swift 中的原生 SDK 的 UI 处理工作。
例子:
/* * Initialize by nib name and bundle. */ let someBundle1 = NSBundle(identifier: "com.example.SomeBundleIdentifier") let someView1 = SomeView.VT_viewFromNibWithName("SomeNibName", locatedInBundle: someBundle1) /* * Initialize by nib name and bundle identifier. */ let someView2 = SomeView.VT_viewFromNibWithName("SomeNibName", locatedInBundleWithIdentifier: "com.example.SomeBundleIdentifier") /* * Initialize by nib name located in main bundle. */ let someView3 = SomeView.VT_viewFromNibLocatedInMainBundleWithNibName("SomeNibName") /* * Also, when you send nil as value for bundle, * view will be loaded from main bundle too. */ let someView4 = SomeView.VT_viewFromNibWithName("SomeNibName", locatedInBundle: nil) /* * Initialize from nib with class name and bundle. */ let someBundle5 = NSBundle(identifier: "com.example.SomeBundleIdentifier") let someView5 = SomeView.VT_viewFromNibWithClassNameLocatedInBundle(someBundle5) /* * Initialize from nib with class name and bundle identifier. */ let someView6 = SomeView.VT_viewFromNibWithClassNameLocatedInBundleWithIdentifier("com.example.SomeBundleIdentifier") /* * Initialize from nib with class name located in main bundle. */ let someView7 = SomeView.VT_viewFromNibWithClassNameLocatedInMainBundle() /* * You can do the same thing by sending nil as value for bundle identifier. * In this case view will be loaded from main bundle too. */ let someView8 = SomeView.VT_viewFromNibWithClassNameLocatedInBundleWithIdentifier(nil)
评论