• Stars
    star
    523
  • Rank 81,758 (Top 2 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 2 years ago

Reviews

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

Repository Details

An eject button for Interface Builder to generate swift code

Eject

Eject is a utility to transition from Interface Builder to programatic view layout. This is done by using code generation to create a .swift file to replace the view hierarchy managed by the .xib file.

Why?

One common pain point with Interface Builder is that as a view becomes more dynamic and is managed more programatically, Interface Builder becomes less helpful. This tool lets developers use Interface Builder without that concern, giving them an Eject button to hit when Interace Builder starts getting in the way, and provides an easy path to transition to full programatic view layout.

But But

Yes, I understand that this is probably a bad idea. But it might not be.

Usage

Install with homebrew:

brew install eject

Use on the command line:

eject --file /path/to/MassiveViewController.xib

Copy and paste code into .swift file, and remove the .xib:

rm /path/to/MassiveViewController.xib

Or to see what changed in a xib file by looking at the changes in generated code:

TMP=`mktemp` && git show HEAD:$XIB > $TMP && diff <(eject --file $XIB ) <(eject --file $TMP)

eject will generate code for everything it can in the .xib file. If there is any XML that eject does not understand, it will print out a warning message. Open an Issue with any warnings, bugs or ideas you may have.

Features

  • UIKit .xib support
  • Constraints (using Anchorage)
  • Outlet and OutletCollection support
  • Good variable names
    • Use the user entered "user label" if present
    • Snake case of the className with the namespace removed
    • Constraint variable names are long, but descriptive, (labelBottomEqualToButtonTop)
  • Code that compiles out of the box is a non-goal
    • Will not generate view1, view2 variable names to avoid compile errors. Supply user labels and re-generate.

Does it work?

The Unit Tests show how much work is done. UIKit coverage is configured by the CocoaTouchBuilder using various Builders. Some configuration is generated from Interface Builder .inspector files.

This should still be considered an Alpha quality tool.

Todo

  • Enhance code generation approaches
  • AppKit support
  • Storyboard support?
  • Use default values to remove un-needed code
  • Better error reporting of un-interpreted flags
  • Explore generating code as a method of diffing .xib files

More Repositories

1

BonMot

Beautiful, easy attributed strings in Swift
Swift
3,507
star
2

RZTransitions

A library of custom iOS View Controller Animations and Interactions.
Objective-C
1,877
star
3

Anchorage

A collection of operators and utilities that simplify iOS layout code.
Swift
625
star
4

RZDataBinding

Lightweight KVO-based data binding options.
Objective-C
543
star
5

RZCellSizeManager

Dynamic size computation and caching for cells.
Objective-C
242
star
6

Swiftilities

A collection of useful Swift utilities.
Swift
184
star
7

BentoMap

Map Clustering for Swift.
Swift
183
star
8

AndroidDatabaseLibraryComparison

Java
148
star
9

RZBluetooth

Core Bluetooth helper library
Objective-C
135
star
10

Singleton

135
star
11

RZUtils

Rightpoint Commonly Used Tools
Objective-C
122
star
12

Parser

112
star
13

RZViewActions

A category on UIView that provides animation structure similar to SKAction from SpriteKit.
Objective-C
103
star
14

ios-template

A `cookiecutter` template for iOS projects
Swift
93
star
15

RaisinToast

A UIWindow subclass used to message information to the users of your app.
Objective-C
83
star
16

FRY

UIKit Integration Library
Objective-C
77
star
17

rust-universal-template

Template for creating Rust libraries with bindings to iOS, Android, WebAssembly and more
Shell
58
star
18

UniversalAdapter

A single adapter implementation for any scrolling view or ViewGroup.
Java
53
star
19

ARKit-CoreML

Utilities and examples for using CoreML in conjunction with ARKit
Swift
46
star
20

RZCollectionList

A framework for dealing with displaying data from Core Data and other sources in UITableViews.
Objective-C
44
star
21

RIGImageGallery

An image gallery view controller designed to work with the Raizlabs Interface Guidelines for iOS
Swift
40
star
22

CardParser

Credit Card Type Parsing for Swift
Swift
40
star
23

FreshAir-Android

Java
40
star
24

Raizlabs-Android-Style

The Raizlabs Android Style Guide
38
star
25

RZAndroidBaseUtils

Base Utility set for Android applications
Java
36
star
26

Griddle

Groovy
34
star
27

RZTouchID

Basic TouchID implementation
Objective-C
34
star
28

Raizlabs-Cocoa-Style

The Raizlabs iOS Style Guide
Objective-C
32
star
29

ViewHolderInflater

31
star
30

android-template

A `cookiecutter` template for Android projects
Kotlin
28
star
31

RZTweenSpirit

Piecewise tweening/animation library for iOS
Objective-C
25
star
32

DebugModule

Java
22
star
33

Shift

A library of custom iOS View Controller Animations and Interactions written in Swift.
Swift
22
star
34

RZVinyl

Stack management, ActiveRecord utilities, and seamless importing for Core Data
Objective-C
21
star
35

Broker

21
star
36

RZDebugMenu

Configurable debug menu for iOS apps
Objective-C
20
star
37

Raze

A supplemental graphics engine for apps
Objective-C
20
star
38

RZImport

Automatic importing of data from NSDictionary to Cocoa objects
Objective-C
18
star
39

Stackable

Supercharged UIStackViews for Swift
Swift
18
star
40

AndroidWebServiceManager

Java
17
star
41

RZIntrinsicContentSizeTextView

Objective-C
17
star
42

RZSafariKeychain

A simple implementation of Safari Keychain
Objective-C
17
star
43

RZSplitViewController

A custom iOS SplitViewController.
16
star
44

FrictionLess

A collection of UX-focused swift components for reducing friction in "user work".
Swift
15
star
45

BoardingPass

A navigation controller interactive pan to push and pop.
Swift
14
star
46

WebServiceManager

13
star
47

Pourcast

JavaScript
12
star
48

SketchyCode

An experimental tool to generate Swift code from Sketch files
Swift
12
star
49

CoreUtils

Java
12
star
50

ViewState

Small library for lightweight UIView and UIViewController state management on iOS
Swift
11
star
51

UniversalFontComponents

A library that allows you to set a custom font in xml for all your TextViews
Java
11
star
52

opencv-swift

OpenCV / Swift Package Manager / XCFramework / Podspec
Ruby
10
star
53

RZNumberPad

Never write a custom number pad from scratch again.
Objective-C
9
star
54

conference-room

Conference room management system
C#
9
star
55

CompoundComponents

Android sample project that shows how to use Compound Components to make reusable UI. Also shows examples for creating reusable UI with the <include> tag and with Fragments.
Java
9
star
56

Geode

Location management made easy.
Swift
8
star
57

RZAssert

Useful assertion macros from the fine folks at Raizlabs.
Objective-C
7
star
58

RZPoseurWebView

RZPoseurWebView
7
star
59

RZEffects

Apply shader effects to UIKit elements.
7
star
60

RZBuildScripts

Xcode command line build script for building/signing/packaging iOS builds
Ruby
7
star
61

Actionable

A cleaner delegation pattern for iOS.
Swift
6
star
62

RZOpenGL

Raizlabs OpenGL Library
6
star
63

ai-discipline-ollama-rag

Python
6
star
64

localizable

Swift command line utility to take a CSV input of strings and output localizable string formats for iOS/macOS and Android.
Swift
5
star
65

RZKeychain

Easy keychain manipulation in iOS
4
star
66

FreshAir

Objective-C
4
star
67

RZLogin

A Reusable Login View Controller.
4
star
68

sample-scrolling-controls-ios

Sample code for a blog post about controls in scroll views on iOS
Swift
4
star
69

RZArrayCandy

Some functional sugar for your NSArrays
4
star
70

RZCollectionTableView

A UICollectionView that behaves like a UITableView
4
star
71

RZMapView

Simple custom mapping for iOS
Objective-C
4
star
72

sample-smart-animated-deselection-ios

Sample code for a blog post on smarter animated deselection on iOS
Swift
4
star
73

sample-float-remapping-ios

Sample code for a blog post on float remapping on iOS
Swift
3
star
74

RZDataManager

An iOS framework for Importing and Managing Data in your App.
3
star
75

slog

A simple logging utility for Swift
Shell
3
star
76

Drafter

Drafter - A nice way to draft up some constraints programmatically
3
star
77

DialogFactory

3
star
78

ios-template-output

For running CircleCI on output of ios-template
Swift
3
star
79

example-xcframework-build

Shell
3
star
80

CtrlZ

3
star
81

jss-react-template

Sample JSS React project using the OpenWeather API
JavaScript
2
star
82

RZRadioKit

2
star
83

viewmodel-inject

Utilizes Dagger to generate a ViewModelProvider.Factory
Kotlin
2
star
84

RZSpriteTools

A library for creating and managing SpriteKit objects.
2
star
85

RZSegmentViewController

A customizable View Controller Container that lets you switch between view controllers using a segment control.
2
star
86

RZAffirm

Raizlabs Swift Assertion Library
Swift
2
star
87

DataHub

Java
2
star
88

RZRevealViewController

RZRevealViewController is a Basement Menu style Containment View Controller.
1
star
89

FlowStacks-iOS-15-Bug

Demonstrating SwiftUI navigation bug in FlowStacks on iOS 15
Swift
1
star
90

maven-releases

1
star
91

PeopleCards

Flashcard game to learn new hire names/faces
JavaScript
1
star
92

AirQualityDashboard-iOS

Air quality dashboard for our BLE AQI device
Swift
1
star
93

RZSequenceController

A view controller container that arranges child view controller in either a horizontal or vertical scrolling flow.
1
star
94

air_quality_bluetooth_le

Bluetooth Low Energy interface for SDS011 APM2.5 air quality sensor
Python
1
star
95

RPLogging

Log level settings for iOS, macOS, tvOS, & watchOS
Swift
1
star
96

react-native-touch-sensor

Java
1
star
97

CustomVisionTools

Useful utilities for training object detection models with Custom Vision.
Python
1
star
98

Azure-Search-Query-Builder

This is a library that uses expression tree parsing to build a parameters object for performing search, suggest, and autocomplete actions with the Azure Search .NET SDK.
C#
1
star