🖼 Gallery App for Actomaton (async/await + Elm Architecture) + SwiftUI.

Overview
Comments
  • Xcode 13.3 (Swift 5.6) causes `error: Segmentation fault: 11` when building SwiftUI-Gallery

    Xcode 13.3 (Swift 5.6) causes `error: Segmentation fault: 11` when building SwiftUI-Gallery

    Bug report: [SR-15983] Xcode 13.3 (Swift 5.6) causes error: Segmentation fault: 11 build error - Swift

    Overview

    New Xcode 13.3 (Swift 5.6) causes error: Segmentation fault: 11 error when building SwiftUI-Gallery iOS app project.

    • https://github.com/inamiy/Actomaton-Gallery/tree/main/Examples/SwiftUI-Gallery

    As of 22fb93f, there was no such build error in Xcode 13.2 (Swift 5.5), but started to occur from Xcode 13.3.

    Steps to reproduce

    Bug-reproducing branch: https://github.com/inamiy/Actomaton-Gallery/tree/bug/Xcode13.3-segfault

    1. 22fb93f Segfault when building Xcode 13.3 (no error in Xcode 13.2)
    2. 8145848 Commented-out Physics module, and Xcode 13.3 build succeeds
    3. 8924c6f Re-enable part of Physics module, and Xcode 13.3 build succeeds
    4. 6231b40 Re-enable more part of Physics module, and Xcode 13.3 build fails due to segfault
      • Fails for both Xcode IDE build and xcodebuild (see also make build-SwiftUI-Gallery)

    So the problematic code seems to live in 6231b40 but no other clues so far. (One possible issue might be protocol extension with associated type constraint i.e. where Obj == CircleObject ?)

    // NOTE: ObjectWorldExample is a protocol with `Obj` as associatedtype 
    extension ObjectWorldExample where Obj == CircleObject
    {
        /// Default impl.
        func draggingEmptyArea(_ objects: inout [Obj], point: CGPoint) {}
    
        /// Default impl.
        func dragEndEmptyArea(_ objects: inout [Obj]) {}
    
        /// Default impl.
        func exampleTapToMakeObject(point: CGPoint) -> Obj?
        {
            CircleObject(position: Vector2(point))
        }
    
        var reducer: Reducer<World.Action, World.State<Obj>, World.Environment>
        {
            World
                .reducer(
                    tick: World.tickForObjects(self.step),
                    tap: { objects, point in
                        if let object = exampleTapToMakeObject(point: point) {
                            objects.append(object)
                        }
                    },
                    draggingObj: { $0.position = Vector2($1) },
                    draggingEmptyArea: self.draggingEmptyArea,
                    dragEndEmptyArea: self.dragEndEmptyArea
                )
        }
    }
    

    2022/03/16 0:07 Update

    43b0a84 could fortunately fix this Swift 5.6 bug by loosing associatedtype constraint from where Obj == CircleObject to where Obj: Equatable with as? Obj downcasting.

    Bug fixing diff: https://github.com/inamiy/Actomaton-Gallery/compare/22fb93f...865c73d

    @@ -90,7 +90,7 @@ protocol ObjectWorldExample: Example
         func exampleTapToMakeObject(point: CGPoint) -> Obj?
     }
     
    -extension ObjectWorldExample where Obj == CircleObject
    +extension ObjectWorldExample where Obj: Equatable // where Obj == CircleObject
     {
         /// Default impl.
         func draggingEmptyArea(_ objects: inout [Obj], point: CGPoint) {}
    @@ -101,7 +101,7 @@ extension ObjectWorldExample where Obj == CircleObject
         /// Default impl.
         func exampleTapToMakeObject(point: CGPoint) -> Obj?
         {
    -        CircleObject(position: Vector2(point))
    +        CircleObject(position: Vector2(point)) as? Obj
         }
     
         var reducer: Reducer<World.Action, World.State<Obj>, World.Environment>
    

    While this workaround can cope the compiler bug from developer-side, the code will now become ugly (which I don't want to merge this PR), so I believe this bug needs to be fixed by Swift compiler team.

    bug 
    opened by inamiy 3
  • How to run the example

    How to run the example

    After clone the repo, update and pre-fetch packages in terminal:

    $> swift package update
    $> xcodebuild -resolvePackageDependencies -scmProvider system
    

    Then, open the Package file:

    $> open Package.swift
    

    After Xcode popup, select scheme SwiftUI-Gallery with iPhone 13 simulator and hit run button, error happens: image

    Is there some steps I missed or something else?

    opened by tomisacat 1
  • SwiftUI-Gallery doesn't work in 'Release' build

    SwiftUI-Gallery doesn't work in 'Release' build

    There is a strange 'Release' build bug in SwiftUI-Gallery example app (as of b8256a7 ) where following console-warning is printed on every action dispatch:

    warning: the Swift runtime was unable to demangle the type of field ''. the mangled type name is '': TypeDecoder.h:1242: Node kind 190 "" - unexpected kind. this field will show up as an empty tuple in Mirrors
    

    While the root cause is still unknown yet, I have spent some time to collect evidences as follows.

    • This bug occurs in SwiftUI-Gallery + 'Release' build only, not in other examples nor configurations
      • Possibly occurred since the initial release (I checked e64520a4d3bb07507550f8fa260bddba31b2ccca in Xcode 13.1 and 13.2, but couldn't test for old Xcode 12.5.1 because macOS 12.1 can't use it)
    • Works fine if not using DebugRoot (TimeTravel feature)

    As most of the example apps work correctly, this is UNLIKELY the issue of core library Actomaton.

    ~~Perhaps the issue might be in RootViewProtocol that uses associatedtype to abstract the type information of Root.Action so that CasePath's reflection might be failing.~~ See fix in #27 .

    bug 
    opened by inamiy 1
  • [Examples] Replace Actomaton-Basic.xcodeproj with .swiftpm

    [Examples] Replace Actomaton-Basic.xcodeproj with .swiftpm

    This PR replaces Actomaton-Basic.xcodeproj example with .swiftpm, with adding portability for iPad Swift Playgrounds without depending on this repo's root Actomaton-Gallery package. (extracting Counter example independently)

    To give a try:

    1. Install latest iPad Swift Playgrounds ver 4
    2. Airdrop .swiftpm to iPad

    See also (video): https://twitter.com/inamiy/status/1471391180760182786

    image

    opened by inamiy 1
  • Value of type 'TaskGroup<Void>' has no member 'addTask'

    Value of type 'TaskGroup' has no member 'addTask'

    Value of type 'TaskGroup' has no member 'addTask' Value of type 'TaskGroup' has no member 'waitForAll'

    Getting this error while running the project on XCODE 11 Beta 3

    Screenshot 2021-09-13 at 1 15 52 PM
    opened by karthikkumar-manian 1
  • [SwiftUI] Add Inject & organize code

    [SwiftUI] Add Inject & organize code

    This PR adds https://github.com/krzysztofzablocki/Inject for hot-reloading support, and organized some code.

    Warning

    As documented in Inject's README:

    The Composable Architecture If like myself you love PointFree Composable Architecture, you’d probably want to inject reducer code, this isn’t possible in vanilla TCA because reducer code is a free function which isn’t as straightforward to replace with injection, but our fork at The Browser Company supports it.

    There are currently crash issues happening while editing SwiftUI views and hot-reloading occurs in SwiftUI-Gallery, which may relate to above discussion.

    enhancement 
    opened by inamiy 0
  • Refactor examples with ActomatonUI

    Refactor examples with ActomatonUI

    BREAKING CHANGE.

    Overview

    This PR refactors entire example code by replacing ActomatonStore module with new ActomatonUI, which is introduced in:

    • https://github.com/Actomaton/Actomaton/pull/66

    It's important to note that core logic (i.e. defining Action, State, Reducer) doesn't change much, as they are non-UI-layer.

    Significant changes happen in SwiftUI.View-layers only where ViewStore started to live with helper WithViewStore, which allows efficient and safer SwiftUI rendering as discussed in above PR.

    For example, changes in CounterView.swift will be like this diff:

    image

    (NOTE: This code is writing @ObservedObject var viewStore manually, but using WithViewStore will often reduce this boilerplate code)

    Also note that RouteStore (Actomaton integration for UIKit Views) won't get affected by https://github.com/Actomaton/Actomaton/pull/66 , as its API signatures will mostly stay the same as before.

    As a side note, there are some minor file / code refactoring being done aside from new module integration.

    enhancement 
    opened by inamiy 0
  • Use `#if swift(>=5.6) && swift(<5.7)` for `-Xfrontend -requirement-machine=off`

    Use `#if swift(>=5.6) && swift(<5.7)` for `-Xfrontend -requirement-machine=off`

    Successor of:

    • https://github.com/Actomaton/Actomaton-Gallery/pull/34

    This PR adds swift(<5.7) to disable -Xfrontend -requirement-machine=off for Xcode 14 (Beta 1) Swift 5.7.

    opened by inamiy 0
  • Add Downloader example

    Add Downloader example

    This PR adds Downloader example using suspendable EffectQueue.

    Also, this PR applies following Actomaton 0.5.2 bug fix:

    • https://github.com/inamiy/Actomaton/pull/46

    Screencast

    Max 2 concurrency downloader example.

    https://user-images.githubusercontent.com/138476/167300509-72c73433-4034-430b-87b3-ba20b559e0c2.mp4

    enhancement 
    opened by inamiy 0
  • Add AnimationDemo

    Add AnimationDemo

    This PR adds AnimationDemo to demonstrate SwiftUI Transaction (animation) handling, which also reproduces current Actomaton 0.4.0 bug that transaction doesn't work as expected.

    (Before fix)

    https://user-images.githubusercontent.com/138476/162989922-7735779a-2a03-48bb-b6fd-af1dc9b94218.mp4

    By applying the fix in:

    • https://github.com/inamiy/Actomaton/pull/39

    SwiftUI animation e.g. withAnimation will now work correctly in Actomaton, except there is NavigationView issue that still doesn't handle well which is subject to investigate for future TODO.

    (After fix)

    https://user-images.githubusercontent.com/138476/162990924-3414e813-ba32-4a24-bd5d-1c3e93d2fd43.mp4

    enhancement 
    opened by inamiy 0
Owner
Yasuhiro Inami
Functional Programmer at @delyjp / KURASHIRU / クラシル. Interests: Swift / Haskell / PureScript / Elm / Rust / TypeScript / Category Theory
Yasuhiro Inami
Photo Gallery App demo using a REST API

Photo Gallery iOS App - (Using Rest API) A demo Photo Gallery App using a Rest API using MVVM architecture in Swift + UIKit. Overview Fully Programmat

Neel Mewada 2 Nov 22, 2021
Nilay Dagdemir 0 Jan 23, 2022
An iOS/tvOS photo gallery viewer, useful for viewing a large (or small!) number of photos.

This project is unmaintained. Alex passed away in an accident in late 2019. His love of iOS development will always be remembered. AXPhotoViewer AXPho

Alex Hill 596 Dec 30, 2022
IRGallery-swift is a powerful gallery for iOS.

IRGallery-swift IRGallery-swift is a powerful gallery for iOS. Features Captions. Rotation support. Load images locally or from a web URL. Custom UITa

Phil Chang 1 Oct 6, 2021
This simple cordova plugin will download picture from an URL and save to IOS Photo Gallery.

Photo Viewer This plugin is intended to download a picture from an URL into IOS Photo library.. How to Install Cordova: cordova plugin add https://git

Alwin jose 1 Oct 23, 2021
A photo gallery for iOS with a modern feature set. Similar features as the Facebook photo browser.

EBPhotoPages ”A photo gallery can become a pretty complex component of an app very quickly. The EBPhotoPages project demonstrates how a developer coul

Eddy Borja 1.7k Dec 8, 2022
iOS photo gallery written in Swift

SwiftPhotoGallery Overview A full screen photo gallery for iOS and tvOS written in Swift. Photos can be panned and zoomed (iOS only) Pinch to zoom (iO

Justin Vallely 271 Dec 17, 2022
Applies filter to a selected image from the Gallery using Combine

CombinePhotoFiltering App CombinePhotoFiltering is an app that applies sepia and bloom to a selected picture from the Photos app. Highlights The app i

Mauricio Esteves 0 Nov 14, 2021
Gallery has a clearer flow based on albums and focuses on the use case of selecting video

Description We all love image pickers, don't we? You may already know of ImagePicker, the all in one solution for capturing pictures and selecting ima

null 1 Sep 14, 2022
Lightweight and customisable async image loading in SwiftUI. Supports on-disk storage, placeholders and more!

Asyncrounously download and display images in Swift UI. Supports progress indicators, placeholders and image transitions. RemoteImageView Asyncrounous

Callum Trounce 192 Dec 7, 2022
An extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memory and disk caching for iOS and  Watch.

KFSwiftImageLoader KFSwiftImageLoader is an extremely high-performance, lightweight, and energy-efficient pure Swift async web image loader with memor

Kiavash Faisali 343 Oct 29, 2022
Rounded async imageview downloader lightly cached and written in Swift

PASImageView ============ **Rounded async imageview downloader lightly cached and written in Swift 3 ** Objective-C version here Snapshot Usage //XIB

Pierre Abi-aad 173 Nov 6, 2022
AYImageKit is a Swift Library for Async Image Downloading, Show Name's Initials and Can View image in Separate Screen.

AYImageKit AYImageKit is a Swift Library for Async Image Downloading. Features Async Image Downloading. Can Show Text Initials. Can have Custom Styles

Adnan Yousaf 11 Jan 10, 2022
Async image downloader with Mem&Disk cached as a UIImageView extension

HBWebImage Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installation HBWebIm

haoboxuxu 1 Oct 22, 2022
Image Editor iOS App - CLEAN Architecture + MVP Pattern

Image Editor iOS Application - Built using UIKit, CoreData, CoreImage, and URLSession Frameworks with CLEAN Architecture and MVP UI design pattern.

Omran Khoja 8 Nov 30, 2022
SwiftUI App Icon Generator App for iOS & macOS Catalyst

SwiftUI App Icon Generator App for iOS & macOS Catalyst Generate Asset Icons easily to your iPhone, iPad, Mac, and Apple Watch Features The app has se

Alfian Losari 21 Sep 14, 2022
A Swift/SwiftUI utility for caching and displaying images in SwiftUI Views

A Swift/SwiftUI utility for caching and displaying images asynchronously. Built with Swift 5.5 and works with async/await.

王雪铮 Xuezheng Wang 1 May 5, 2022
This package integrates a UIImagePickerController into a SwiftUI app.

This Swift Package integrates a UIImagePickerController into a SwiftUI app and allows a user to select, scale and position an image to be cropped and saved as a conatct's photo, similar to the stock iOS Contacts app.

Rillieux 58 Dec 26, 2022
GIFImage component for your SwiftUI app!

SwiftUI GIF Lightweight SwiftUI component for rendering GIFs from data or assets, with no external dependencies. As a bonus, there's an extension that

Gordan Glavaš 17 Dec 6, 2022