• Stars
    star
    1,074
  • Rank 41,393 (Top 0.9 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 7 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A micro-framework for observing file changes, both local and remote. Helpful in building developer tools.

KZFileWatchers

Demo GIF

CI Status Version License Platform

Wouldn't it be great if we could adjust feeds and configurations of our native apps without having to sit back to Xcode, change code, recompile and navigate back to screen we were at?

One of the basis of building tools that allow us to do just that is the way we observe for data changes, this micro-framework provides you File observers for Local and Remote assets.

This framework provides:

  • FileWatcher.Local useful for observing local file changes, it can also be used to breach Sandbox env for debug simulator builds and e.g. observe file on the developer desktop (like the demo app does).

  • FileWatcher.Remote can be used to observe files on the web, it supports both Etag headers and Last-Modified-Date so you can just put file on Dropbox or real ftp server.

It also supports usage from Objective-C projects. For this, you should consider these following steps:

  1. Add $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) into your projects Library Search Paths in Build Setting section.

  2. Import swift-header by adding @import KZFileWatchers; into any .m file, where you want to use FileWatchers.

  3. Use provided classes for set up file observing like this:

self.fileWatcher = [[LocalFileWatcher alloc] initWithPath:path];
self.fileWatcher.delegate = self;
[self.fileWatcher startWithError:nil];
  1. Implement FileWatcherDelegate in your class for handling file refreshing events. For example:
- (void)refreshDidOccurFrom:(id<FileWatcherProtocol>)fileWatcher type:(enum RefreshResult)type data:(NSData *)data
{
    self.textLabel.text = [[NSString alloc] initWithData:data encoding:kCFStringEncodingUTF8];
}

Installation

KZFileWatchers is available through CocoaPods and Swift Package Manager.

CocoaPods

In order to install KZFileWatchers by using CocoaPods, simply add the following line to your Podfile:

pod "KZFileWatchers"

Last version to support Swift 2.3 is 0.1.2 Last version to support Swift 3.0 is 1.0.4

Swift Package Manager

Installing KZFileWatchers over SwiftPM is only supported since version 1.0.1. You just need to add it as a dependency to your Package.swift manifest:

import PackageDescription

let package = Package(
    name: "YourProject",
    dependencies: [
        .package(url: "https://github.com/krzysztofzablocki/KZFileWatchers.git", from: "1.1.0"),
        // other dependencies
    ],
    targets: [
        .executableTarget(name: "YourApp", dependencies: [
            .product(name: "KZFileWatchers", package: "KZFileWatchers"),
            // other dependencies
        ]
    ]
)

Author

Krzysztof Zabłocki, [email protected]

Contributing

Contributions to KZFileWatchers are welcomed and encouraged! Please see the Contributing guide.

A list of contributors is available through GitHub.

To give clarity of what is expected of our members, KZFileWatchers has adopted the code of conduct defined by the Contributor Covenant. This document is used across many open source communities. For more, see the Code of Conduct.

License

KZFileWatchers is available under the MIT license. See LICENSE for more information.

More Repositories

1

Sourcery

Meta-programming for Swift, stop writing boilerplate code.
Swift
7,507
star
2

LifetimeTracker

Find retain cycles / memory leaks sooner.
Swift
3,052
star
3

Playgrounds

Better playgrounds that work both for Objective-C and Swift
Objective-C
2,632
star
4

Bootstrap

iOS project bootstrap aimed at high quality coding.
Objective-C
2,047
star
5

Inject

Hot Reloading for Swift applications!
Swift
1,914
star
6

Swift-Macros

A curated list of awesome Swift Macros
Swift
1,863
star
7

LineDrawing

Beatiful and fast smooth line drawing algorithm for iOS - as seen in Foldify.
Objective-C
1,287
star
8

Difference

Simple way to identify what is different between 2 instances of any type. Must have for TDD.
Swift
1,200
star
9

PropertyMapper

Property mapping for Objective-C iOS apps.
Objective-C
1,126
star
10

LinkedConsole

Clickable links in your Xcode console, so you never wonder which class logged the message.
Swift
934
star
11

Traits

Modify your native iOS app in real time.
Swift
905
star
12

IconOverlaying

Build informations on top of your app icon.
Shell
650
star
13

crafter

Crafter - Xcode project configuration CLI made easy.
Ruby
547
star
14

Strongify

Strongify is a 1-file µframework providing a nicer API for avoiding weak-strong dance.
Swift
444
star
15

KZNodes

Have you ever wonder how you could make Origami like editor in 1h ?
Objective-C
335
star
16

SFObservers

NSNotificationCenter and KVO auto removal of observers.
Objective-C
309
star
17

AutomaticSettings

Data driven settings UI generation.
Swift
300
star
18

CCNode-SFGestureRecognizers

Adding UIGestureRecognizers to cocos2d, painless.
Objective-C
202
star
19

DetailsMatter

Objective-C
198
star
20

Pinch-to-reveal

Pinch to reveal animation transition built with Layer masking, as seen in boeing app for iPad.
Objective-C
193
star
21

ViewModelOwners

Protocols that help make your MVVM setup more consistent
Swift
143
star
22

KZAsserts

Asserts on roids, test all your assumptions with ease.
Objective-C
100
star
23

SFContainerViewController

UIViewControllers containment predating Apple implementation. Works in both 4.x and 5.x iOS, no memory or hierarchy issues.
Objective-C
82
star
24

OhSnap

Reproduce bugs your user saw by capturing and replaying data snapshots with ease.
Swift
81
star
25

Versionable

Migration for `Codable` objects.
Swift
79
star
26

Swift-Observable

Native KVO like behaviour build in Swift.
Swift
64
star
27

BehavioursExample

Objective-C
58
star
28

SourceryWorkshops

Swift
45
star
29

Learn-iOS-GameDev-Level-0

Teeter clone accompanying tutorial at http://merowing.info/2013/04/learn-ios-game-dev-level-0/
Objective-C
24
star
30

XibReferencing

Simple category and sample showing how you can reference one Xib view from another
Objective-C
20
star
31

NSObject-SFExecuteOnDealloc

A simple category on NSObject that allows you to execute block when object is deallocated
Objective-C
18
star
32

KZImageSplitView

Objective-C
17
star
33

jenkins_jobs_to_statusboard

Ruby script that generates html table for embedding in StatusBoard by Panic http://panic.com/statusboard/
Ruby
15
star
34

SourceryPro-Feedback

Repository for discussing https://merowing.info/sourcery-pro/
12
star
35

krzysztofzablocki

2
star
36

krzysztofzablocki.github.io

Blog
HTML
2
star
37

starter-hugo-academic

Jupyter Notebook
1
star