illyabusigin / apptools

A collection of tools for building iOS apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

App Tools

Tests Status Go Report Card PkgGoDev

This repository contains tools that help make building apps easier.

NOTE: The package is still a work-in-progress and should not be considered ready for production use. Use at your own risk!

entitlements package

The entitlements package providers a builder for declaring and generating your App.entitlements file for your Xcode project.

Features include:

  • Functional approach
  • Extensible
  • String output
  • Write to file

See it in action:

package main

import (
	"fmt"
	"log"

	"github.com/illyabusigin/apptools/entitlements"
)

func main() {
	e := entitlements.New()
	e.DataProtection.Complete()
	e.APS.Production()

	output, err := e.Build()
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(output)
}

plist package

The plist package provides methods for declaring and generating your Info.plist for your Xcode project. This package is built on the delightful howett.net/plist package.

Features include:

  • Functional approach
  • Strongly typed
  • Built-in validation with human-readale errors
  • Extensible
  • Output to a string or file

See it in action:

package main

import (
	"fmt"
	"log"

	"github.com/illyabusigin/apptools/plist"
)

func main() {
	plist := plist.New(plist.PlatformIOS)
	plist.Defaults()
	plist.DisplayName("BestApp")
	plist.BundleID("com.best.app")
	plist.AppTransportSecurity(func(s *AppTransportSecurity) {
		s.AllowArbitraryLoads(true)
	})
	plist.Orientations(func(o *Orientations) {
		o.Portrait()
		o.LandscapeLeft()
		o.LandscapeRight()
		o.UpsideDown()
	})
	plist.Privacy(func(p *Privacy) {
		p.Calendar("Let me use your calendar")
	})

	output, err := e.Build()
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(output)
}

xcassets package

The xcassets package provides methods for declaring and generating Xcode assets. You can choose to generate one-off assets or your entire .xcassets folder.

Features include:

  • Generate app icon, colors, launch images
  • Support for remote images
  • Functional approach
  • Strongly typed
  • Built-in validation with human-readale errors
  • Output to a string or file

See it in action:

Application Icon

package main

import (
	"fmt"
	"log"

	"github.com/illyabusigin/apptools/xcassets"
)

func main() {
	builder := AppIcon("AppIcon", func(b *AppIconBuilder) {
		b.File("./testdata/Icon.png")
		b.Phone().Configure(func(b *AppIconPhone) {
			b.Settings.File("./testdata/Icon.png") // override individual icon configurations
		})
		b.AppStore()
	})

    if err := builder.Validate(); err != nil {
        log.Fatal("Failed validation", err)
    }

	err := builder.SaveTo("./_test/", true)
}

Launch Images

TBD

Assets

TBD

Colors

package main

import (
	"fmt"
	"log"

	"github.com/illyabusigin/apptools/xcassets"
)

func main() {
	splashScreenColor := Color("SplashScreenColor", func(b *xcassets.ColorBuilder) {
		b.Gamut.Any()
		b.Gamut.SRGBAndDisplayP3()
		b.Color(func(d *xcassets.ColorDefinition) {
			d.Devices.Universal()
			d.ColorSpace.SRGB()
			d.Appearance.Any()

			d.Hex("#262D44")
			d.Alpha(.4)
		})
	})

	output, err := splashScreenColor.Build()
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(output)
}

About

A collection of tools for building iOS apps

License:MIT License


Languages

Language:Go 100.0%