Using NSArray, NSMutableArray, NSDictionary, NSMutableDictionary, NSMutableString safely.

nsarray, nsdictionary, nsmutablearray, nsmutabledictionary, nsmutablestring, objective-c
pod try FFSafeKit



CI Status Cocoapods Version Carthage compatible Platform MIT License FFSafeKit Issues Twitter

Using NSArray, NSMutableArray, NSDictionary, NSMutableDictionary, NSMutableString safely by FFSafeKit.


  • Safely access NSArray
  • Safely access NSDictionary
  • Safely access & perform changes to NSMutableArray
  • Safely access & perform changes to NSMutableDictionary
  • Safely access & perform changes to NSMutableString


  • iOS 8.0+ / macOS 10.13.6+
  • Xcode 10.1 (10B61) +


To run the FFSafeKit project, clone the Repo, and start FFSafeKit in Xcode.

$ git clone https://github.com/JonyFang/FFSafeKit.git
$ cd FFSafeKit
$ open FFSafeKit.xcodeproj


There are three ways to use FFSafeKit in your project:

  • Installation with CocoaPods
  • Installation with Carthage
  • Manually install


CocoaPods is a dependency manager, which automates and simplifies the process of using 3rd-party libraries like FFSafeKit in your projects. First, add the following line to your Podfile:

pod 'FFSafeKit'

If you want to use the latest features of FFSafeKit use normal external source dependencies.

pod 'FFSafeKit', :git => 'https://github.com/JonyFang/FFSafeKit.git'

This pulls from the master branch directly.

Second, install FFSafeKit into your project:

$ pod install


Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate FFSafeKit into your Xcode project using Carthage, specify it in your Cartfile:

github "JonyFang/FFSafeKit"

Run the following command to build the framework:

$ carthage update

Drag the built FFSafeKit.framework binaries from Carthage/Build/iOS into your application’s Xcode project.

On your application targets’ Build Phases settings tab, click the + icon and choose New Run Script Phase. Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:

/usr/local/bin/carthage copy-frameworks

Add the following paths to the frameworks you want to use under Input Files.


For an in depth guide, read on from Adding frameworks to an application.


Alternatively you can directly add the FFSafeKit folder source files to your project.

  • Download the latest code version or add the repository as a git submodule to your git-tracked project.
  • Open your project in Xcode, then drag and drop FFSafeKit folder onto your project (use the "Product Navigator view"). Make sure to select Copy items when asked if you extracted the code archive outside of your project.
  • Include FFSafeKit wherever you need it with #import "FFSafeKit.h".


Import the library where you want to use it.

#import <FFSafeKit.h>


FFSafeKit is available under the MIT license. See the LICENSE file for more info.