Git Product home page Git Product logo

ios-stream-chat's Introduction

Loves finding reasonable solutions.

⭐️ Favorite motto

Failure is an option. If you’re not failing now and then, you’re not being innovative enough or taking enough risks.

Link to blog badge Link to LinkedIn badge Send an email badge

Ryan's GitHub stats

ios-stream-chat's People

Contributors

ryan-son avatar yagom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

ios-stream-chat's Issues

ChatRoomViewModel 구현

ChatRoom 서비스와 ChatRoomViewController 사이에서 View Model 작업을 담당할 타입을 구현합니다.

  • ChatRoom 서비스와 delegate를 통한 수신 메시지 메모리 저장 및 뷰 반영
  • messages 뷰 모델 변화에 따른 ChatRoomViewController 뷰 반영을 위한 데이터 바인딩
  • index 기준 message 찾기
  • View에서 발생한 send 이벤트 처리 (w/ ChatRoom 서비스)
  • String -> Message 타입 변환 지원 메서드

JoinChatRoomViewController 기본 구현

사용자 이름을 입력할 수 있는 로그인 뷰의 기본적인 기능을 구현합니다.

  • 사용자 이름을 입력할 수 있는 텍스트 필드
  • return을 통한 ChatRoom 이동
  • 버튼을 통한 ChatRoom 이동

소켓 통신 담당 타입 구현

Stream을 이용하여 소켓 통신을 수행하는 타입을 구현합니다.

  • 네트워크 통신 셋업
    • InputStream / OutputStream 초기화 (호스트 및 포트 설정)
    • StreamDelegate 설정
    • Stream을 RunLoop에 스케줄링
    • Stream open
  • 채팅 입장 시 스트림 데이터 형식에 따라 outputStream에 write 수행
  • 메시지 전송을 위한 send 메서드 구현
  • 이벤트 발생에 따른 작업 처리를 위해 StreamDelegatestream(_:handle:) 메서드 구현
  • inputStream으로 전송 받은 바이트를 읽어 들일 메서드 구현
    • 읽어들인 바이트로부터 새로운 메시지를 만들고 나타내기 위한 메서드 구현

스트림 데이터 형식

상황 데이터 형식
채팅 참가 알림 USR_NAME::{username}::END
타인의 채팅참가 알림 수신 {username} has joined
타인의 채팅 중단 알림 수신 {username} has left
메시지 전송 MSG::{message}::END
메시지 수신 {username}::{message}
채팅방 나가기 LEAVE::::END

ChatRoomViewController 기본 구현

메시지를 확인할 수 있는 기본 뷰를 구현합니다.

  • TableView
  • TableViewCell (이름, 메시지, 이니셜 동그라미)
    • Left
    • Right
    • System
  • Send를 위한 MessageInputBar
    • TextField
    • Send button
  • Send 버튼 기능 구현

프로젝트 설정

개발에 앞서 프로젝트를 설정합니다.

  • SwiftLint 적용 및 규칙 설정
  • 폴더 구조 설정 및 Info.plist 경로 재설정
  • Main.storyboard 삭제 및 window 설정
  • Bundle Identifier 재설정

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.