FBRemoteNibLoader 0.1.3

FBRemoteNibLoader 0.1.3

测试测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最新发布2014年12月

Felipe Baytelman 维护。



iOS 库,允许获取远程编译和压缩的 .xib 文件,并从获取的 .xibs 中加载 UIViewControllers

FBRemoteNibLoader 允许您获取 NIB 文件的新版本,而无需更新 AppStore 中的应用程序

此库不包含任何编译后的源代码,因此它应符合苹果的指南。

安装

使用方法

// Load a view controller using FBRemoteNibLoader, instead of initWithNibName.
// If such nib has not been cached yet, it will user the original .xib file

UIViewController * vc = [[FBRemoteNibLoader sharedController] viewControllerWithNibName:@"ViewControllerClassName"];
[self presentViewController:vc
                   animated:YES
                 completion:^{
                     NSLog(@"Presented view controller");
                 }];

// In order to load a remote .zip file

NSURL * url = [NSURL URLWithString:@"https:///nibs.zip"];
[[FBRemoteNibLoader sharedController] loadRemoteNibsFrom:url
                                              completion:^(BOOL success) {
                                                  NSLog(@"Success? %@", @(success));
                                              }];

// You can clear the cache, to use the original .xib files included in the file.

[[FBRemoteNibLoader sharedController] clearCache];

远程压缩文件结构

file.zip

  • ViewController1ClassName.xib.bin
  • ViewController2ClassName.xib.bin
  • ViewController3ClassName.xib.bin

要创建 .xib.bin 文件,请使用以下命令

ibtool original.xib --compile original.xib.bin

(此处省略了示例)

  • 打开所提供的 XCode 项目(记得获取一些 pods:pod install)。

  • 运行一次。如果您在点击“显示弹出层”之前点击“加载远程 nibs”,您将使用原始 .xib 文件。

  • 当您点击“加载远程 nibs”时,FBRemoteNibLoader 将从应用程序的文档目录中提取.url和拆解它。

  • 然后,“显示弹出层”将使用从 zip 中提取的缓存的 .xib 文件,加载。

待办事项 & 贡献

这是我将来想包括的功能

  • 创建 POD 描述。
  • 确保它不会被苹果拒绝。
  • 获取完整的包(包括图片)。
  • 更新图像获取机制,以便如果您在下载的一组中获取了更新的图像,则它们将同时在新的和旧的 xib 文件中使用。

作者

Felipe Baytelman,[email protected]

许可证

FBRemoteNibLoader 在 MIT 许可证下提供。有关更多信息,请参阅 LICENSE 文件。